diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-09-05 18:33:20 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-09-05 18:33:20 +0000 |
commit | 46fbf95b16622d33bcb791f0489bee1f87fb33e5 (patch) | |
tree | eb8393d65ba723e0998073fd963748da7c0c54dc | |
parent | b303e8d3b7c31ebccabb0b3238104f5f019c5b6a (diff) | |
download | puppet-46fbf95b16622d33bcb791f0489bee1f87fb33e5.tar.gz puppet-46fbf95b16622d33bcb791f0489bee1f87fb33e5.tar.xz puppet-46fbf95b16622d33bcb791f0489bee1f87fb33e5.zip |
Adding an "ignoretags" attribute to transaction, and setting it for downloading plugins or facts, and for creating config directories
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1562 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r-- | lib/puppet/client/master.rb | 16 | ||||
-rw-r--r-- | lib/puppet/config.rb | 1 | ||||
-rwxr-xr-x | lib/puppet/daemon.rb | 4 | ||||
-rw-r--r-- | lib/puppet/transaction.rb | 4 | ||||
-rw-r--r-- | test/other/transactions.rb | 4 |
5 files changed, 17 insertions, 12 deletions
diff --git a/lib/puppet/client/master.rb b/lib/puppet/client/master.rb index ba6e7ec84..8ab251728 100644 --- a/lib/puppet/client/master.rb +++ b/lib/puppet/client/master.rb @@ -78,7 +78,7 @@ class Puppet::Client::MasterClient < Puppet::Client def self.facts # Retrieve the facts from the central server. if Puppet[:factsync] - self.class.getfacts() + self.getfacts() end facts = {} @@ -517,6 +517,7 @@ class Puppet::Client::MasterClient < Puppet::Client begin trans = objects.evaluate + trans.ignoretags = true trans.evaluate rescue Puppet::Error => detail if Puppet[:debug] @@ -541,18 +542,25 @@ class Puppet::Client::MasterClient < Puppet::Client Facter.clear path = Puppet[:factpath].split(":") + files = [] download(:dest => Puppet[:factdest], :source => Puppet[:factsource], :ignore => Puppet[:factsignore], :name => "fact") do |object| next unless path.include?(File.dirname(object[:path])) + files << object[:path] + + end + + Facter.clear + files.each do |file| begin Puppet.info "Loading fact %s" % - File.basename(File.basename(object[:path])).sub(".rb",'') - load object[:path] + File.basename(File.basename(file)).sub(".rb",'') + load file rescue => detail Puppet.warning "Could not reload fact %s: %s" % - [object[:path], detail] + [file, detail] end end ensure diff --git a/lib/puppet/config.rb b/lib/puppet/config.rb index 3c2f20e1a..2817ce612 100644 --- a/lib/puppet/config.rb +++ b/lib/puppet/config.rb @@ -588,6 +588,7 @@ Generated on #{Time.now}. Puppet[:tags] = "" end trans = objects.evaluate + trans.ignoretags = true trans.evaluate if tags Puppet[:tags] = tags diff --git a/lib/puppet/daemon.rb b/lib/puppet/daemon.rb index 79241deb6..a19124545 100755 --- a/lib/puppet/daemon.rb +++ b/lib/puppet/daemon.rb @@ -48,8 +48,8 @@ module Puppet def fqdn unless defined? @fqdn and @fqdn - hostname = Facter["hostname"].value - domain = Facter["domain"].value + hostname = Facter.value("hostname") + domain = Facter.value("domain") @fqdn = [hostname, domain].join(".") end return @fqdn diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb index 899aaa456..b9a9376e8 100644 --- a/lib/puppet/transaction.rb +++ b/lib/puppet/transaction.rb @@ -6,7 +6,7 @@ require 'puppet/statechange' module Puppet class Transaction - attr_accessor :component, :objects, :tags, :ignoreschedules + attr_accessor :component, :objects, :tags, :ignoreschedules, :ignoretags include Puppet::Util @@ -160,7 +160,7 @@ class Transaction begin allevents = @objects.collect { |child| events = nil - if (tags.nil? or child.tagged?(tags)) + if (self.ignoretags or tags.nil? or child.tagged?(tags)) if self.ignoreschedules or child.scheduled? @objectmetrics[:scheduled] += 1 # Perform the actual changes diff --git a/test/other/transactions.rb b/test/other/transactions.rb index 02acaa8e7..aea593c1f 100644 --- a/test/other/transactions.rb +++ b/test/other/transactions.rb @@ -13,10 +13,6 @@ require 'test/unit' class TestTransactions < Test::Unit::TestCase include FileTesting - # In case they're not in more than one group - def test_nothing - end - def test_reports path1 = tempfile() path2 = tempfile() |