diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2005-11-01 00:06:14 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2005-11-01 00:06:14 +0000 |
commit | 14d8186ebe8740eab1b320e6a1d6c98c255ad70f (patch) | |
tree | b98daca4feaf4165e518f62a12bc39a9aec872e6 /lib | |
parent | 03357432210eecc5f370f812f473bc5d0a062d64 (diff) | |
download | puppet-14d8186ebe8740eab1b320e6a1d6c98c255ad70f.tar.gz puppet-14d8186ebe8740eab1b320e6a1d6c98c255ad70f.tar.xz puppet-14d8186ebe8740eab1b320e6a1d6c98c255ad70f.zip |
Making paths work a little more intelligently
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@739 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet.rb | 4 | ||||
-rw-r--r-- | lib/puppet/log.rb | 17 | ||||
-rw-r--r-- | lib/puppet/type.rb | 11 | ||||
-rw-r--r-- | lib/puppet/type/component.rb | 11 | ||||
-rw-r--r-- | lib/puppet/type/pfile.rb | 12 |
5 files changed, 35 insertions, 20 deletions
diff --git a/lib/puppet.rb b/lib/puppet.rb index 7fe07de3d..b66e00cb8 100644 --- a/lib/puppet.rb +++ b/lib/puppet.rb @@ -1,5 +1,3 @@ -#!/usr/local/bin/ruby -w - require 'singleton' require 'puppet/log' @@ -13,7 +11,7 @@ require 'puppet/log' # # it's also a place to find top-level commands like 'debug' module Puppet - PUPPETVERSION="0.9.0" + PUPPETVERSION="1.0.0" def Puppet.version return PUPPETVERSION diff --git a/lib/puppet/log.rb b/lib/puppet/log.rb index 7c30e88b5..c470dd5df 100644 --- a/lib/puppet/log.rb +++ b/lib/puppet/log.rb @@ -188,6 +188,22 @@ module Puppet # :nodoc: end when Puppet::Client::LogClient unless msg.is_a?(String) or msg.remote + unless defined? @hostname + @hostname = Facter["hostname"].value + end + unless defined? @domain + @domain = Facter["domain"].value + if @domain + @hostname += "." + @domain + end + end + if msg.source =~ /^\// + msg.source = @hostname + ":" + msg.source + elsif msg.source == "Puppet" + msg.source = @hostname + " " + msg.source + else + msg.source = @hostname + " " + msg.source + end begin #puts "would have sent %s" % msg #puts "would have sent %s" % @@ -198,6 +214,7 @@ module Puppet # :nodoc: puts "Could not dump: %s" % detail.to_s return end + # Add the hostname to the source dest.addlog(tmp) #dest.addlog(msg.to_s) sleep(0.5) diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index 73963d2aa..6ac98359e 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -918,9 +918,16 @@ class Type < Puppet::Element def path unless defined? @path if defined? @parent - @path = [@parent.path, self.name].flatten.to_s + if self.is_a?(Puppet::Type::Component) + @path = @parent.path + "/" + self.name + else + @path = @parent.path + "/" + self.class.name.to_s + "=" + self.name + end else - @path = self.name.to_s + # The top-level name is always puppet[top], so we don't bother with + # that. And we don't add the hostname here, it gets added + # in the log server thingy. + @path = "/" end end diff --git a/lib/puppet/type/component.rb b/lib/puppet/type/component.rb index c9b97f71f..c3a3440c3 100644 --- a/lib/puppet/type/component.rb +++ b/lib/puppet/type/component.rb @@ -90,8 +90,6 @@ module Puppet # this is only called on one component over the whole system # this also won't work with scheduling, but eh def evaluate - # but what about dependencies? - transaction = Puppet::Transaction.new(self.flatten) transaction.component = self return transaction @@ -99,7 +97,14 @@ module Puppet def name #return self[:name] - return "%s[%s]" % [self[:type],self[:name]] + unless defined? @name + if self[:type] == self[:name] + @name = self[:type] + else + @name = "%s[%s]" % [self[:type],self[:name]] + end + end + return @name end def push(*ary) diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb index fd9831447..2c1a68a25 100644 --- a/lib/puppet/type/pfile.rb +++ b/lib/puppet/type/pfile.rb @@ -172,18 +172,6 @@ module Puppet super end - def path - if defined? @parent - if @parent.is_a?(self.class) - return [@parent.path, File.basename(self.name)].flatten.to_s - else - return [@parent.path, self.name].flatten.to_s - end - else - return [self.name].to_s - end - end - def parambackup=(value) case value when false, "false": |