summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-01-12 01:58:19 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-01-12 01:58:19 +0000
commit411ab22588da2cbe76d186fbd4b59f6194766c4d (patch)
tree149909b773377b9a11bf5f68e7d104b1f975047c /lib
parent97fb6c91d60cfe20f0521a7148d202ed25434b7d (diff)
downloadpuppet-411ab22588da2cbe76d186fbd4b59f6194766c4d.tar.gz
puppet-411ab22588da2cbe76d186fbd4b59f6194766c4d.tar.xz
puppet-411ab22588da2cbe76d186fbd4b59f6194766c4d.zip
Adding autorequire to files, and added the cwd to the list of files to be required for exec. Also, exec catches inline files and autorequires them.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@805 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/type.rb3
-rwxr-xr-xlib/puppet/type/exec.rb19
-rw-r--r--lib/puppet/type/pfile.rb10
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