diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-02-16 19:10:34 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-02-16 19:10:34 +0000 |
| commit | 1fdb96266e2d1a083e1ecc76c5ae136ba73f2999 (patch) | |
| tree | d600505c4b15bb699c9531903e6647102292a697 /lib | |
| parent | 5f8d61553a9d83087604fe5b68146503cf55d1be (diff) | |
| download | puppet-1fdb96266e2d1a083e1ecc76c5ae136ba73f2999.tar.gz puppet-1fdb96266e2d1a083e1ecc76c5ae136ba73f2999.tar.xz puppet-1fdb96266e2d1a083e1ecc76c5ae136ba73f2999.zip | |
Changing transactions to be one-stage instead of two, and changing most of the type classes to use "obj[:name]" instead of "obj.name" where appropriate, because "obj.name" might be a symbolic name (e.g., File.unlink(file.name) will not do what you want if file.name == "sshdconfig" but file[:path] == "/etc/ssh/sshd_config")
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@922 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
26 files changed, 161 insertions, 113 deletions
diff --git a/lib/puppet/parser/ast/node.rb b/lib/puppet/parser/ast/node.rb index 79fdd50d7..2e33eb672 100644 --- a/lib/puppet/parser/ast/node.rb +++ b/lib/puppet/parser/ast/node.rb @@ -48,7 +48,6 @@ class Puppet::Parser::AST # Evaluate our parent class. def evalparent(scope) if @parentclass - Puppet.warning "evaluating parent %s" % @parentclass # This is pretty messed up. I don't know if this will # work in the long term, but we need to evaluate the node # in our own scope, even though our parent node has diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb index 27a64eec6..641a05758 100644 --- a/lib/puppet/parser/scope.rb +++ b/lib/puppet/parser/scope.rb @@ -251,7 +251,6 @@ module Puppet # And now evaluate each set klass within the nodescope. classes.each { |klass| if code = scope.lookuptype(klass) - Puppet.warning "evaluating %s" % klass code.safeevaluate(scope, {}, klass, klass) end } diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb index 0cf13a9e1..588c0b71d 100644 --- a/lib/puppet/transaction.rb +++ b/lib/puppet/transaction.rb @@ -41,12 +41,26 @@ class Transaction # then, we need to pass the event to the object's containing component, # to see if it or any of its parents have subscriptions on the event def evaluate - Puppet.debug "Beginning transaction %s with %s changes" % - [self.object_id, @changes.length] + #Puppet.debug "Beginning transaction %s with %s changes" % + # [self.object_id, @changes.length] + count = 0 now = Time.now - events = @changes.collect { |change| - if change.is_a?(Puppet::StateChange) + events = @objects.find_all { |child| + child.scheduled? + }.collect { |child| + # these children are all Puppet::Type instances + # not all of the children will return a change, and Containers + # return transactions + #ary = child.evaluate + #ary + changes = child.evaluate + unless changes.is_a? Array + changes = [changes] + end + changes.collect { |change| + @changes << change + count += 1 change.transaction = self events = nil begin @@ -76,15 +90,52 @@ class Transaction change.changed = true end events - else - puts caller - raise Puppet::DevError, - "Transactions cannot handle objects of type %s" % change.class - end - }.flatten.reject { |event| - event.nil? + } + }.flatten.reject { |child| + child.nil? # remove empties } - +# events = @changes.collect { |change| +# if change.is_a?(Puppet::StateChange) +# change.transaction = self +# events = nil +# begin +# # use an array, so that changes can return more than one +# # event if they want +# events = [change.forward].flatten.reject { |e| e.nil? } +# #@@changed.push change.state.parent +# rescue => detail +# change.state.err "change from %s to %s failed: %s" % +# [change.state.is_to_s, change.state.should_to_s, detail] +# #Puppet.err("%s failed: %s" % [change.to_s,detail]) +# if Puppet[:debug] +# puts detail.backtrace +# end +# next +# # FIXME this should support using onerror to determine +# # behaviour; or more likely, the client calling us +# # should do so +# end +# +# # This is kinda lame, because it can result in the same +# # object being modified multiple times, but that's difficult +# # to avoid as long as we're syncing each state individually. +# change.state.parent.cache(:synced, now) +# +# unless events.nil? or (events.is_a?(Array) and events.empty?) +# change.changed = true +# end +# events +# else +# puts caller +# raise Puppet::DevError, +# "Transactions cannot handle objects of type %s" % change.class +# end +# }.flatten.reject { |event| +# event.nil? +# } + + Puppet.debug "Finishing transaction %s with %s changes" % + [self.object_id, count] #@triggerevents = [] events.each { |event| object = event.source @@ -112,21 +163,24 @@ class Transaction @toplevel = true self.class.init end + + @changes = [] + # change collection is in-band, and message generation is out-of-band # of course, exception raising is also out-of-band now = Time.now.to_i - @changes = @objects.find_all { |child| - child.scheduled? - }.collect { |child| - # these children are all Puppet::Type instances - # not all of the children will return a change, and Containers - # return transactions - #ary = child.evaluate - #ary - child.evaluate - }.flatten.reject { |child| - child.nil? # remove empties - } +# @changes = @objects.find_all { |child| +# child.scheduled? +# }.collect { |child| +# # these children are all Puppet::Type instances +# # not all of the children will return a change, and Containers +# # return transactions +# #ary = child.evaluate +# #ary +# child.evaluate +# }.flatten.reject { |child| +# child.nil? # remove empties +# } end #--------------------------------------------------------------- diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index 748a69906..9a80f18bb 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -1151,7 +1151,7 @@ class Type < Puppet::Element # Store the object by name self[obj.name] = obj - if name != obj[self.namevar] + if name != obj[self.namevar] and obj.class.isomorphic? self.alias(obj[self.namevar], obj) end diff --git a/lib/puppet/type/exec.rb b/lib/puppet/type/exec.rb index b12bf159d..5fe57bb26 100755 --- a/lib/puppet/type/exec.rb +++ b/lib/puppet/type/exec.rb @@ -393,7 +393,6 @@ module Puppet end self[:command].scan(/^(#{File::SEPARATOR}\S+)/) { |str| - self.warning "adding %s" % str reqs << str } @@ -417,10 +416,7 @@ module Puppet def check self.class.checks.each { |check| if @parameters.include?(check) - if @parameters[check].check - self.debug "%s returned true" % check - else - self.debug "%s returned false" % check + unless @parameters[check].check return false end end diff --git a/lib/puppet/type/group.rb b/lib/puppet/type/group.rb index bc7f6cf1e..e5e69848c 100755 --- a/lib/puppet/type/group.rb +++ b/lib/puppet/type/group.rb @@ -99,7 +99,7 @@ module Puppet def getinfo(refresh = false) if @groupinfo.nil? or refresh == true begin - @groupinfo = Etc.getgrnam(self.name) + @groupinfo = Etc.getgrnam(self[:name]) rescue ArgumentError => detail @groupinfo = nil end diff --git a/lib/puppet/type/nameservice/netinfo.rb b/lib/puppet/type/nameservice/netinfo.rb index b8c108578..7c297fe7d 100644 --- a/lib/puppet/type/nameservice/netinfo.rb +++ b/lib/puppet/type/nameservice/netinfo.rb @@ -31,7 +31,7 @@ module Puppet # Does the object already exist? def self.exists?(obj) cmd = "nidump -r /%s/%s /" % - [obj.class.netinfodir, obj.name] + [obj.class.netinfodir, obj[:name]] output = %x{#{cmd} 2>/dev/null} if output == "" @@ -101,7 +101,7 @@ module Puppet name = $1 value = $2.sub(/\s+$/, '') - if name == @parent.name + if name == @parent[:name] if value =~ /^[-0-9]+$/ @is = Integer(value) else @@ -128,7 +128,7 @@ module Puppet cmd << arg cmd << "/" << "/%s/%s" % - [@parent.class.netinfodir, @parent.name] + [@parent.class.netinfodir, @parent[:name]] #if arg == "-create" # return [cmd.join(" "), self.modifycmd].join(";") @@ -145,7 +145,7 @@ module Puppet cmd = ["niutil"] cmd << "-createprop" << "/" << "/%s/%s" % - [@parent.class.netinfodir, @parent.name] + [@parent.class.netinfodir, @parent[:name]] if key = self.class.netinfokey cmd << key << "'%s'" % self.should diff --git a/lib/puppet/type/nameservice/objectadd.rb b/lib/puppet/type/nameservice/objectadd.rb index bc3c0f2b5..2d88d24f1 100644 --- a/lib/puppet/type/nameservice/objectadd.rb +++ b/lib/puppet/type/nameservice/objectadd.rb @@ -65,13 +65,13 @@ module Puppet cmd << self.class.objectaddflag << gid end end - cmd << @parent.name + cmd << @parent[:name] return cmd.join(" ") end def deletecmd - "groupdel %s" % @parent.name + "groupdel %s" % @parent[:name] end def modifycmd @@ -79,7 +79,7 @@ module Puppet "groupmod", self.class.objectaddflag, "'%s'" % self.should, - @parent.name + @parent[:name] ].join(" ") end end @@ -109,13 +109,13 @@ module Puppet cmd << "-M" else end - cmd << @parent.name + cmd << @parent[:name] cmd.join(" ") end def deletecmd - ["userdel", @parent.name].join(" ") + ["userdel", @parent[:name]].join(" ") end def modifycmd @@ -123,7 +123,7 @@ module Puppet "usermod", self.class.objectaddflag, "'%s'" % self.should, - @parent.name + @parent[:name] ].join(" ") end end diff --git a/lib/puppet/type/package/apt.rb b/lib/puppet/type/package/apt.rb index 28d5ef6ca..c959503ae 100755 --- a/lib/puppet/type/package/apt.rb +++ b/lib/puppet/type/package/apt.rb @@ -9,7 +9,7 @@ module Puppet def install should = self.should(:ensure) - str = self.name + str = self[:name] case should when true, false, Symbol # pass @@ -29,7 +29,7 @@ module Puppet # What's the latest package version available? def latest - cmd = "apt-cache showpkg %s" % self.name + cmd = "apt-cache showpkg %s" % self[:name] output = %x{#{cmd} 2>&1} unless $? == 0 diff --git a/lib/puppet/type/package/bsd.rb b/lib/puppet/type/package/bsd.rb index 086b5880e..376c5296a 100755 --- a/lib/puppet/type/package/bsd.rb +++ b/lib/puppet/type/package/bsd.rb @@ -21,10 +21,10 @@ module Puppet def query hash = {} # list out our specific package - info = %x{pkg_info #{self.name} 2>/dev/null} + info = %x{pkg_info #{self[:name]} 2>/dev/null} # Search for the version info - if info =~ /Information for #{self.name}-(\S+)/ + if info =~ /Information for #{self[:name]}-(\S+)/ hash[:version] = $1 hash[:ensure] = :present else @@ -70,7 +70,7 @@ module Puppet end def uninstall - cmd = "pkg_delete %s" % self.name + cmd = "pkg_delete %s" % self[:name] output = %x{#{cmd} 2>&1} if $? != 0 raise Puppet::PackageError.new(output) diff --git a/lib/puppet/type/package/dpkg.rb b/lib/puppet/type/package/dpkg.rb index 97220d2fd..8b6882d3a 100755 --- a/lib/puppet/type/package/dpkg.rb +++ b/lib/puppet/type/package/dpkg.rb @@ -12,7 +12,7 @@ module Puppet hash = {} # list out our specific package - open("| dpkg -l %s 2>/dev/null" % self.name) { |process| + open("| dpkg -l %s 2>/dev/null" % self[:name]) { |process| # our regex for matching dpkg output regex = %r{^(.)(.)(.)\s(\S+)\s+(\S+)\s+(.+)$} @@ -93,7 +93,7 @@ module Puppet end def uninstall - cmd = "dpkg -r %s" % self.name + cmd = "dpkg -r %s" % self[:name] output = %x{#{cmd} 2>&1} if $? != 0 raise Puppet::PackageError.new(output) diff --git a/lib/puppet/type/package/rpm.rb b/lib/puppet/type/package/rpm.rb index 11906558e..06ae3c51f 100755 --- a/lib/puppet/type/package/rpm.rb +++ b/lib/puppet/type/package/rpm.rb @@ -7,7 +7,7 @@ module Puppet :description => "DESCRIPTION" } - cmd = "rpm -q #{self.name} --qf '%s\n'" % + cmd = "rpm -q #{self[:name]} --qf '%s\n'" % "%{NAME} %{VERSION}-%{RELEASE}" self.debug "Executing %s" % cmd.inspect @@ -75,7 +75,7 @@ module Puppet #} def uninstall - cmd = "rpm -e %s" % self.name + cmd = "rpm -e %s" % self[:name] output = %x{#{cmd}} if $? != 0 raise output diff --git a/lib/puppet/type/package/sun.rb b/lib/puppet/type/package/sun.rb index 2a04a9e1f..e8e17bdf4 100755 --- a/lib/puppet/type/package/sun.rb +++ b/lib/puppet/type/package/sun.rb @@ -50,7 +50,7 @@ module Puppet hash = {} # list out all of the packages - open("| pkginfo -l %s 2>/dev/null" % self.name) { |process| + open("| pkginfo -l %s 2>/dev/null" % self[:name]) { |process| # we're using the long listing, so each line is a separate # piece of information process.each { |line| @@ -133,7 +133,7 @@ module Puppet #} def uninstall - cmd = "pkgrm -n %s 2>&1" % self.name + cmd = "pkgrm -n %s 2>&1" % self[:name] output = %x{#{cmd}} if $? != 0 raise Puppet::Error, "Removal of %s failed: %s" % [self.name, output] diff --git a/lib/puppet/type/package/yum.rb b/lib/puppet/type/package/yum.rb index 5a9361392..1cb652704 100755 --- a/lib/puppet/type/package/yum.rb +++ b/lib/puppet/type/package/yum.rb @@ -6,7 +6,7 @@ module Puppet # Install a package using 'apt-get'. def install - cmd = "yum -y install %s" % self.name + cmd = "yum -y install %s" % self[:name] self.info "Executing %s" % cmd.inspect output = %x{#{cmd} 2>&1} @@ -18,7 +18,7 @@ module Puppet # What's the latest package version available? def latest - cmd = "yum list %s" % self.name + cmd = "yum list %s" % self[:name] self.info "Executing %s" % cmd.inspect output = %x{#{cmd} 2>&1} @@ -26,7 +26,7 @@ module Puppet raise Puppet::PackageError.new(output) end - if output =~ /#{self.name}\S+\s+(\S+)\s/ + if output =~ /#{self[:name]}\S+\s+(\S+)\s/ return $1 else self.debug "No version" @@ -45,7 +45,7 @@ module Puppet self.info "performing initial install" return self.install end - cmd = "yum -y update %s" % self.name + cmd = "yum -y update %s" % self[:name] self.info "Executing %s" % cmd.inspect output = %x{#{cmd} 2>&1} diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb index 69f636bec..ec0bb393f 100644 --- a/lib/puppet/type/pfile.rb +++ b/lib/puppet/type/pfile.rb @@ -178,7 +178,7 @@ module Puppet return children unless self[:ignore] self[:ignore].each { |ignore| ignored = [] - Dir.glob(File.join(self.name,ignore), File::FNM_DOTMATCH) { |match| + Dir.glob(File.join(self[:path],ignore), File::FNM_DOTMATCH) { |match| ignored.push(File.basename(match)) } children = children - ignored @@ -216,7 +216,7 @@ module Puppet "Must pass relative paths to PFile#newchild()" ) else - path = File.join(self.name, path) + path = File.join(self[:path], path) end args[:path] = path @@ -375,18 +375,18 @@ module Puppet end def localrecurse(recurse) - unless FileTest.exist?(self.name) and self.stat.directory? + unless FileTest.exist?(self[:path]) and self.stat.directory? #self.info "%s is not a directory; not recursing" % - # self.name + # self[:path] return end - unless FileTest.readable? self.name + unless FileTest.readable? self[:path] self.notice "Cannot manage %s: permission denied" % self.name return end - children = Dir.entries(self.name) + children = Dir.entries(self[:path]) #Get rid of ignored children if @parameters.include?(:ignore) @@ -511,7 +511,7 @@ module Puppet def stat(refresh = false) if @stat.nil? or refresh == true begin - @stat = File.lstat(self.name) + @stat = File.lstat(self[:path]) rescue Errno::ENOENT => error @stat = nil rescue => error diff --git a/lib/puppet/type/pfile/checksum.rb b/lib/puppet/type/pfile/checksum.rb index f237f2b3b..607a1c012 100755 --- a/lib/puppet/type/pfile/checksum.rb +++ b/lib/puppet/type/pfile/checksum.rb @@ -88,7 +88,7 @@ module Puppet # because we cannot sum directories, just delete ourselves # from the file so we won't sync - @parent.delete(self.name) + @parent.delete(self[:path]) return else begin @@ -101,7 +101,7 @@ module Puppet end if text.nil? self.info "Not checksumming empty file %s" % - @parent.name + @parent[:path] sum = 0 else sum = Digest::MD5.hexdigest(text) @@ -109,7 +109,7 @@ module Puppet } rescue Errno::EACCES => detail self.notice "Cannot checksum %s: permission denied" % - @parent.name + @parent[:path] @parent.delete(self.class.name) rescue => detail self.notice "Cannot checksum %s: %s" % @@ -139,8 +139,8 @@ module Puppet self.fail "Invalid checksum type '%s'" % value end - if FileTest.directory?(@parent.name) - self.info "Reverting directory sum type to timestamp" + if FileTest.directory?(@parent[:path]) + self.debug "Reverting directory sum type to timestamp" value = "time" end @@ -157,13 +157,13 @@ module Puppet @checktypes = ["md5"] end - unless FileTest.exists?(@parent.name) + unless FileTest.exists?(@parent[:path]) self.is = :absent return end - if FileTest.directory?(@parent.name) and @checktypes[0] =~ /md5/ - self.info "Using timestamp on directory" + if FileTest.directory?(@parent[:path]) and @checktypes[0] =~ /md5/ + self.debug "Using timestamp on directory" @checktypes = ["time"] end @@ -217,7 +217,7 @@ module Puppet unless @parent.state(:source) self.warning( "File %s does not exist -- cannot checksum" % - @parent.name + @parent[:path] ) end return nil diff --git a/lib/puppet/type/pfile/content.rb b/lib/puppet/type/pfile/content.rb index 7260579b0..88b59e0f5 100755 --- a/lib/puppet/type/pfile/content.rb +++ b/lib/puppet/type/pfile/content.rb @@ -27,12 +27,12 @@ module Puppet # We should probably take advantage of existing md5 sums if they're there, # but I really don't feel like dealing with the complexity right now. def retrieve - unless FileTest.exists?(@parent.name) + unless FileTest.exists?(@parent[:path]) @is = :absent return end begin - @is = File.read(@parent.name) + @is = File.read(@parent[:path]) rescue => detail @is = nil raise Puppet::Error, "Could not read %s: %s" % @@ -44,7 +44,7 @@ module Puppet # Just write our content out to disk. def sync begin - File.open(@parent.name, "w") { |f| + File.open(@parent[:path], "w") { |f| f.print self.should f.flush } diff --git a/lib/puppet/type/pfile/ensure.rb b/lib/puppet/type/pfile/ensure.rb index ed5d624f1..8b5ad5aba 100755 --- a/lib/puppet/type/pfile/ensure.rb +++ b/lib/puppet/type/pfile/ensure.rb @@ -13,7 +13,7 @@ module Puppet nodefault newvalue(:absent) do - File.unlink(@parent.name) + File.unlink(@parent[:path]) end aliasvalue(:false, :absent) @@ -46,9 +46,9 @@ module Puppet mode = @parent.should(:mode) Puppet::Util.asuser(asuser()) { if mode - Dir.mkdir(@parent.name,mode) + Dir.mkdir(@parent[:path],mode) else - Dir.mkdir(@parent.name) + Dir.mkdir(@parent[:path]) end } @parent.setchecksum @@ -73,7 +73,7 @@ module Puppet end def check - basedir = File.dirname(@parent.name) + basedir = File.dirname(@parent[:path]) if ! FileTest.exists?(basedir) raise Puppet::Error, @@ -119,7 +119,7 @@ module Puppet def disabled_sync event = nil - basedir = File.dirname(@parent.name) + basedir = File.dirname(@parent[:path]) if ! FileTest.exists?(basedir) raise Puppet::Error, @@ -171,9 +171,9 @@ module Puppet when "directory": Puppet::Util.asuser(asuser) { if mode - Dir.mkdir(@parent.name,mode) + Dir.mkdir(@parent[:path],mode) else - Dir.mkdir(@parent.name) + Dir.mkdir(@parent[:path]) end } event = :directory_created @@ -182,13 +182,13 @@ module Puppet # This value is only valid when we're rolling back a creation, # so we verify that the file has not been modified since then. - unless FileTest.size(@parent.name) == 0 + unless FileTest.size(@parent[:path]) == 0 raise Puppet::Error.new( "Created file %s has since been modified; cannot roll back." ) end - File.unlink(@parent.name) + File.unlink(@parent[:path]) else error = Puppet::Error.new( "Somehow got told to create a %s file" % self.should) diff --git a/lib/puppet/type/pfile/mode.rb b/lib/puppet/type/pfile/mode.rb index 3d593caef..3aeaca7be 100755 --- a/lib/puppet/type/pfile/mode.rb +++ b/lib/puppet/type/pfile/mode.rb @@ -59,7 +59,7 @@ module Puppet # If we're a directory, we need to be executable for all cases # that are readable. This should probably be selectable, but eh. def dirmask(value) - if FileTest.directory?(@parent.name) + if FileTest.directory?(@parent[:path]) if value & 0400 != 0 value |= 0100 end @@ -96,7 +96,7 @@ module Puppet self.debug "%s: after refresh, is '%o'" % [self.class.name,@is] if @is == :absent self.info "File does not exist; cannot set mode" % - @parent.name + @parent[:path] return nil end @@ -117,7 +117,7 @@ module Puppet File.chmod(mode,@parent[:path]) rescue => detail error = Puppet::Error.new("failed to chmod %s: %s" % - [@parent.name, detail.message]) + [@parent[:path], detail.message]) raise error end return :file_changed diff --git a/lib/puppet/type/pfile/source.rb b/lib/puppet/type/pfile/source.rb index 0370106df..d2561a658 100755 --- a/lib/puppet/type/pfile/source.rb +++ b/lib/puppet/type/pfile/source.rb @@ -188,11 +188,11 @@ module Puppet end unless @stats[:type] == "file" - if @stats[:type] == "directory" - [@parent.name, @is.inspect, @should.inspect] - end + #if @stats[:type] == "directory" + #[@parent.name, @is.inspect, @should.inspect] + #end raise Puppet::DevError, "Got told to copy non-file %s" % - @parent.name + @parent[:path] end unless defined? @source @@ -220,13 +220,13 @@ module Puppet @source end - if FileTest.exists?(@parent.name) + if FileTest.exists?(@parent[:path]) # this makes sure we have a copy for posterity @backed = @parent.handlebackup end # create the file in a tmp location - args = [@parent.name + ".puppettmp", + args = [@parent[:path] + ".puppettmp", File::CREAT | File::WRONLY | File::TRUNC] # try to create it with the correct modes to start @@ -237,7 +237,7 @@ module Puppet # FIXME we should also change our effective user and group id - exists = File.exists?(@parent.name) + exists = File.exists?(@parent[:path]) begin File.open(*args) { |f| f.print contents @@ -246,23 +246,23 @@ module Puppet # since they said they want a backup, let's error out # if we couldn't make one raise Puppet::Error, "Could not create %s to %s: %s" % - [@source, @parent.name, detail.message] + [@source, @parent[:path], detail.message] end - if FileTest.exists?(@parent.name) + if FileTest.exists?(@parent[:path]) begin - File.unlink(@parent.name) + File.unlink(@parent[:path]) rescue => detail self.err "Could not remove %s for replacing: %s" % - [@parent.name, detail] + [@parent[:path], detail] end end begin - File.rename(@parent.name + ".puppettmp", @parent.name) + File.rename(@parent[:path] + ".puppettmp", @parent[:path]) rescue => detail self.err "Could not rename tmp %s for replacing: %s" % - [@parent.name, detail] + [@parent[:path], detail] end if @stats.include? :checksum diff --git a/lib/puppet/type/schedule.rb b/lib/puppet/type/schedule.rb index b3bcb9d1b..a62f41dcf 100755 --- a/lib/puppet/type/schedule.rb +++ b/lib/puppet/type/schedule.rb @@ -296,7 +296,7 @@ module Puppet end def self.mkdefaultschedules - Puppet.info "Creating default schedules" + Puppet.debug "Creating default schedules" # Create our default schedule self.create( :name => "puppet", diff --git a/lib/puppet/type/service.rb b/lib/puppet/type/service.rb index b8a606d49..631db4a1f 100644 --- a/lib/puppet/type/service.rb +++ b/lib/puppet/type/service.rb @@ -193,7 +193,7 @@ module Puppet of a service, then the service name will be used instead. The pattern can be a simple string or any legal Ruby pattern." - defaultto { @parent.name } + defaultto { @parent[:name] } end newparam(:restart) do desc "Specify a *restart* command manually. If left diff --git a/lib/puppet/type/service/debian.rb b/lib/puppet/type/service/debian.rb index 37c33d333..7e6c6d35d 100755 --- a/lib/puppet/type/service/debian.rb +++ b/lib/puppet/type/service/debian.rb @@ -5,7 +5,7 @@ require 'puppet/type/service/init' Puppet.type(:service).newsvctype(:debian, :init) do # Remove the symlinks def disable - output = %x{update-rc.d -f #{self.name} remove 2>/dev/null} + output = %x{update-rc.d -f #{self[:name]} remove 2>/dev/null} unless $? == 0 raise Puppet::Error, "Could not disable %s: %s" % @@ -14,7 +14,7 @@ Puppet.type(:service).newsvctype(:debian, :init) do end def enabled? - output = %x{update-rc.d -n -f #{self.name} remove 2>/dev/null} + output = %x{update-rc.d -n -f #{self[:name]} remove 2>/dev/null} unless $? == 0 raise Puppet::Error, "Could not check %s: %s" % [self.name, output] @@ -33,7 +33,7 @@ Puppet.type(:service).newsvctype(:debian, :init) do if runlevel raise Puppet::Error, "Specification of runlevels is not supported" else - output = %x{update-rc.d #{self.name} defaults 2>/dev/null} + output = %x{update-rc.d #{self[:name]} defaults 2>/dev/null} end unless $? == 0 diff --git a/lib/puppet/type/service/init.rb b/lib/puppet/type/service/init.rb index 9b8b960cc..f8d059031 100755 --- a/lib/puppet/type/service/init.rb +++ b/lib/puppet/type/service/init.rb @@ -85,7 +85,7 @@ Puppet.type(:service).newsvctype(:init) do if defined? @initscript return @initscript else - @initscript = self.search(self.name) + @initscript = self.search(self[:name]) end end diff --git a/lib/puppet/type/service/smf.rb b/lib/puppet/type/service/smf.rb index b98e47eb4..5f849a16a 100755 --- a/lib/puppet/type/service/smf.rb +++ b/lib/puppet/type/service/smf.rb @@ -2,11 +2,11 @@ # somewhat obvious. Puppet.type(:service).newsvctype(:smf) do def restartcmd - "svcadm restart %s" % self.name + "svcadm restart %s" % self[:name] end def startcmd - "svcadm enable %s" % self.name + "svcadm enable %s" % self[:name] end def status @@ -14,7 +14,7 @@ Puppet.type(:service).newsvctype(:smf) do super return end - %x{/usr/bin/svcs -l #{self.name} 2>/dev/null}.split("\n").each { |line| + %x{/usr/bin/svcs -l #{self[:name]} 2>/dev/null}.split("\n").each { |line| var = nil value = nil if line =~ /^(\w+)\s+(.+)/ @@ -50,7 +50,7 @@ Puppet.type(:service).newsvctype(:smf) do end def stopcmd - "svcadm disable %s" % self.name + "svcadm disable %s" % self[:name] end end diff --git a/lib/puppet/type/symlink.rb b/lib/puppet/type/symlink.rb index b225ec9ff..a0b36f0cf 100755 --- a/lib/puppet/type/symlink.rb +++ b/lib/puppet/type/symlink.rb @@ -159,7 +159,7 @@ module Puppet # working in pfile args = { - :path => @parent.name, + :path => @parent[:path], :linkmaker => true, :recurse => recurse, :source => @target |
