[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.6-1-356-g5718585
James Turnbull
james at lovedthanlost.net
Fri Jan 23 14:21:57 UTC 2009
The following commit has been merged in the master branch:
commit 68ffd46c9fd87e07d0171e7daa54b951f621c7b7
Author: Andrew Shafer <andrew at reductivelabs.com>
Date: Mon Dec 8 00:09:50 2008 -0700
Bug #1803 Zfs should auto require the ancestor file systems
diff --git a/lib/puppet/type/zfs.rb b/lib/puppet/type/zfs.rb
index d3af3a4..3a8806a 100755
--- a/lib/puppet/type/zfs.rb
+++ b/lib/puppet/type/zfs.rb
@@ -40,6 +40,12 @@ module Puppet
#strip the zpool off the zfs name and autorequire it
[@parameters[:name].value.split('/')[0]]
end
+
+ autorequire(:zfs) do
+ #slice and dice, we want all the zfs before this one
+ names = @parameters[:name].value.split('/')
+ names.slice(1..-2).inject([]) { |a,v| a << "#{a.last}/#{v}" }.collect { |fs| names[0] + fs }
+ end
end
end
diff --git a/spec/unit/type/zfs.rb b/spec/unit/type/zfs.rb
index 434415e..bce6500 100755
--- a/spec/unit/type/zfs.rb
+++ b/spec/unit/type/zfs.rb
@@ -25,4 +25,21 @@ describe zpool do
zpool.attrclass(parameter).ancestors.should be_include(Puppet::Parameter)
end
end
+
+ it "should autorequire the containing zfss and the zpool" do
+ #this is a little funky because the autorequire depends on a property with a feature
+ foo_pool = Puppet.type(:zpool).create(:name => "foo")
+
+ foo_bar_zfs = Puppet.type(:zfs).create(:name => "foo/bar")
+ foo_bar_baz_zfs = Puppet.type(:zfs).create(:name => "foo/bar/baz")
+ foo_bar_baz_buz_zfs = Puppet.type(:zfs).create(:name => "foo/bar/baz/buz")
+
+ config = Puppet::Node::Catalog.new :testing do |conf|
+ [foo_pool, foo_bar_zfs, foo_bar_baz_zfs, foo_bar_baz_buz_zfs].each { |resource| conf.add_resource resource }
+ end
+
+ req = foo_bar_baz_buz_zfs.autorequire.collect { |edge| edge.source.ref }
+
+ [foo_pool.ref, foo_bar_zfs.ref, foo_bar_baz_zfs.ref].each { |ref| req.include?(ref).should == true }
+ end
end
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list