summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorDavid Lutterkort <lutter@redhat.com>2009-10-05 20:32:38 -0700
committerJames Turnbull <james@lovedthanlost.net>2009-10-24 08:36:58 +1100
commit66a44ddc3032654109036371a5f3a60dd2ab4a9f (patch)
tree95f790721ec7b8389f1813ef3fc1d23affb890c1 /spec
parentc61335f66f897bc64992c4e9209ea517193c8e30 (diff)
downloadpuppet-66a44ddc3032654109036371a5f3a60dd2ab4a9f.tar.gz
puppet-66a44ddc3032654109036371a5f3a60dd2ab4a9f.tar.xz
puppet-66a44ddc3032654109036371a5f3a60dd2ab4a9f.zip
type augeas: add 'incl' and 'lens' parameters
These parameters allow loading a file anywhere on the filesystem; using them also greatly speeds up processing the resource. * lib/puppet/type/augeas.rb: add 'incl' and 'lens' parameters; change default for 'context' when 'incl' is given. * lib/puppet/provider/augeas/augeas.rb: when 'lens' and 'incl' are given, only load that file * spec/unit/type/augeas.rb: check that constraints on new parameters are enforced This fixes ticket #2694
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/type/augeas.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/unit/type/augeas.rb b/spec/unit/type/augeas.rb
index 5276d2cf2..2c1b04453 100644
--- a/spec/unit/type/augeas.rb
+++ b/spec/unit/type/augeas.rb
@@ -103,4 +103,18 @@ describe augeas do
changes.retrieve.should == :need_to_run
end
end
+
+ describe "loading specific files" do
+ it "should require lens when incl is used" do
+ lambda { augeas.new(:name => :no_lens, :incl => "/etc/hosts")}.should raise_error(Puppet::Error)
+ end
+
+ it "should require incl when lens is used" do
+ lambda { augeas.new(:name => :no_incl, :lens => "Hosts.lns") }.should raise_error(Puppet::Error)
+ end
+
+ it "should set the context when a specific file is used" do
+ augeas.new(:name => :no_incl, :lens => "Hosts.lns", :incl => "/etc/hosts")[:context].should == "/files/etc/hosts"
+ end
+ end
end