diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/type.rb | 3 | ||||
-rwxr-xr-x | lib/puppet/type/exec.rb | 19 | ||||
-rw-r--r-- | lib/puppet/type/pfile.rb | 10 |
3 files changed, 30 insertions, 2 deletions
diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index af74e76c1..fa87de641 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -1046,6 +1046,9 @@ class Type < Puppet::Element # Retrieve the list of names from the block. next unless list = self.instance_eval(&block) + unless list.is_a?(Array) + list = [list] + end list.each { |dep| if obj = typeobj[dep] unless self.requires?(obj) diff --git a/lib/puppet/type/exec.rb b/lib/puppet/type/exec.rb index 5d96dabd7..9570c86b8 100755 --- a/lib/puppet/type/exec.rb +++ b/lib/puppet/type/exec.rb @@ -265,9 +265,24 @@ module Puppet end autorequire(:file) do - if self[:command] =~ /^#{File::SEPARATOR}/ - self[:command].sub(/\s.+/,'') + reqs = [] + + # Stick the cwd in there if we have it + if self[:cwd] + reqs << self[:cwd] end + + tmp = self[:command].dup + + # And search the command line for files, adding any we find. This + # will also catch the command itself if it's fully qualified. It might + # not be a bad idea to add unqualified files, but, well, that's a + # bit more annoying to do. + while tmp.sub!(%r{(#{File::SEPARATOR}\S+)}, '') + reqs << $1 + end + + reqs end def output diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb index dfe76b401..c13e7038d 100644 --- a/lib/puppet/type/pfile.rb +++ b/lib/puppet/type/pfile.rb @@ -75,6 +75,16 @@ module Puppet end end + autorequire(:file) do + cur = [] + # Skip the nil in the beginning and don't add ourselves as a prereq + # either. + self.name.split(File::SEPARATOR)[1..-2].collect { |dir| + cur << dir + "/" + cur.join(File::SEPARATOR) + } + end + @depthfirst = false |