diff options
| author | Nick Lewis <nick@puppetlabs.com> | 2011-06-08 17:18:22 -0700 |
|---|---|---|
| committer | Nick Lewis <nick@puppetlabs.com> | 2011-06-08 18:01:31 -0700 |
| commit | 376e0f04af01810d00eede4de52744bb8c8e1681 (patch) | |
| tree | 4723aa8e5667a664dffa2f3cd10832d9b511b604 /lib | |
| parent | 4922409a2bdf3ad6a094762c9e2e60371ed16a1b (diff) | |
| parent | b1a506c7dec849415073e1bf4b3c92f3c898d6d9 (diff) | |
| download | puppet-376e0f04af01810d00eede4de52744bb8c8e1681.tar.gz puppet-376e0f04af01810d00eede4de52744bb8c8e1681.tar.xz puppet-376e0f04af01810d00eede4de52744bb8c8e1681.zip | |
Merge branch '2.6.x' into 2.7.x
Conflicts:
acceptance/tests/ticket_5477_master_not_dectect_sitepp.rb
lib/puppet/application/apply.rb
lib/puppet/configurer.rb
lib/puppet/configurer/fact_handler.rb
spec/unit/application/apply_spec.rb
spec/unit/configurer/fact_handler_spec.rb
spec/unit/configurer_spec.rb
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/puppet/application/agent.rb | 2 | ||||
| -rw-r--r-- | lib/puppet/application/apply.rb | 13 | ||||
| -rw-r--r-- | lib/puppet/configurer.rb | 25 | ||||
| -rw-r--r-- | lib/puppet/configurer/fact_handler.rb | 7 | ||||
| -rw-r--r-- | lib/puppet/defaults.rb | 19 | ||||
| -rw-r--r-- | lib/puppet/transaction/report.rb | 2 | ||||
| -rw-r--r-- | lib/puppet/util/settings/file_setting.rb | 1 |
7 files changed, 49 insertions, 20 deletions
diff --git a/lib/puppet/application/agent.rb b/lib/puppet/application/agent.rb index 06a158fb3..f0442648b 100644 --- a/lib/puppet/application/agent.rb +++ b/lib/puppet/application/agent.rb @@ -320,7 +320,7 @@ Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License unless fingerprint = cert.fingerprint(options[:digest]) raise ArgumentError, "Could not get fingerprint for digest '#{options[:digest]}'" end - Puppet.notice fingerprint + puts fingerprint end def onetime diff --git a/lib/puppet/application/apply.rb b/lib/puppet/application/apply.rb index 5779e799c..3ba06d34a 100644 --- a/lib/puppet/application/apply.rb +++ b/lib/puppet/application/apply.rb @@ -168,13 +168,18 @@ Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License end # Collect our facts. - unless facts = Puppet::Node::Facts.indirection.find(Puppet[:certname]) - raise "Could not find facts for #{Puppet[:certname]}" + unless facts = Puppet::Node::Facts.indirection.find(Puppet[:node_name_value]) + raise "Could not find facts for #{Puppet[:node_name_value]}" + end + + unless Puppet[:node_name_fact].empty? + Puppet[:node_name_value] = facts.values[Puppet[:node_name_fact]] + facts.name = Puppet[:node_name_value] end # Find our Node - unless node = Puppet::Node.indirection.find(Puppet[:certname]) - raise "Could not find node #{Puppet[:certname]}" + unless node = Puppet::Node.indirection.find(Puppet[:node_name_value]) + raise "Could not find node #{Puppet[:node_name_value]}" end # Merge in the facts. diff --git a/lib/puppet/configurer.rb b/lib/puppet/configurer.rb index cfeb73a1f..980da634e 100644 --- a/lib/puppet/configurer.rb +++ b/lib/puppet/configurer.rb @@ -84,16 +84,8 @@ class Puppet::Configurer end # Get the remote catalog, yo. Returns nil if no catalog can be found. - def retrieve_catalog - if Puppet::Resource::Catalog.indirection.terminus_class == :rest - # This is a bit complicated. We need the serialized and escaped facts, - # and we need to know which format they're encoded in. Thus, we - # get a hash with both of these pieces of information. - fact_options = facts_for_uploading - else - fact_options = {} - end - + def retrieve_catalog(fact_options) + fact_options ||= {} # First try it with no cache, then with the cache. unless (Puppet[:use_cached_catalog] and result = retrieve_catalog_from_cache(fact_options)) or result = retrieve_new_catalog(fact_options) if ! Puppet[:usecacheonfailure] @@ -130,13 +122,20 @@ class Puppet::Configurer Puppet.err "Failed to prepare catalog: #{detail}" end + if Puppet::Resource::Catalog.indirection.terminus_class == :rest + # This is a bit complicated. We need the serialized and escaped facts, + # and we need to know which format they're encoded in. Thus, we + # get a hash with both of these pieces of information. + fact_options = facts_for_uploading + end + options[:report] ||= Puppet::Transaction::Report.new("apply") report = options[:report] Puppet::Util::Log.newdestination(report) if catalog = options[:catalog] options.delete(:catalog) - elsif ! catalog = retrieve_catalog + elsif ! catalog = retrieve_catalog(fact_options) Puppet.err "Could not retrieve catalog; skipping run" return end @@ -220,7 +219,7 @@ class Puppet::Configurer def retrieve_catalog_from_cache(fact_options) result = nil @duration = thinmark do - result = Puppet::Resource::Catalog.indirection.find(Puppet[:certname], fact_options.merge(:ignore_terminus => true)) + result = Puppet::Resource::Catalog.indirection.find(Puppet[:node_name_value], fact_options.merge(:ignore_terminus => true)) end Puppet.notice "Using cached catalog" result @@ -233,7 +232,7 @@ class Puppet::Configurer def retrieve_new_catalog(fact_options) result = nil @duration = thinmark do - result = Puppet::Resource::Catalog.indirection.find(Puppet[:certname], fact_options.merge(:ignore_cache => true)) + result = Puppet::Resource::Catalog.indirection.find(Puppet[:node_name_value], fact_options.merge(:ignore_cache => true)) end result rescue SystemExit,NoMemoryError diff --git a/lib/puppet/configurer/fact_handler.rb b/lib/puppet/configurer/fact_handler.rb index abe032010..803495773 100644 --- a/lib/puppet/configurer/fact_handler.rb +++ b/lib/puppet/configurer/fact_handler.rb @@ -16,7 +16,12 @@ module Puppet::Configurer::FactHandler # compile them and then "cache" them on the server. begin reload_facter - Puppet::Node::Facts.indirection.find(Puppet[:certname]) + facts = Puppet::Node::Facts.indirection.find(Puppet[:node_name_value]) + unless Puppet[:node_name_fact].empty? + Puppet[:node_name_value] = facts.values[Puppet[:node_name_fact]] + facts.name = Puppet[:node_name_value] + end + facts rescue SystemExit,NoMemoryError raise rescue Exception => detail diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 139c3c763..07442d0e9 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -493,6 +493,25 @@ module Puppet ) setdefaults(:agent, + :node_name_value => { :default => "$certname", + :desc => "The explicit value used for the node name for all requests the agent + makes to the master. WARNING: This setting is mutually exclusive with + node_name_fact. Changing this setting also requires changes to the default + auth.conf configuration on the Puppet Master. Please see + http://links.puppetlabs.com/node_name_value for more information." + }, + :node_name_fact => { :default => "", + :desc => "The fact name used to determine the node name used for all requests the agent + makes to the master. WARNING: This setting is mutually exclusive with + node_name_value. Changing this setting also requires changes to the default + auth.conf configuration on the Puppet Master. Please see + http://links.puppetlabs.com/node_name_fact for more information.", + :hook => proc do |value| + if !value.empty? and Puppet[:node_name_value] != Puppet[:certname] + raise "Cannot specify both the node_name_value and node_name_fact settings" + end + end + }, :localconfig => { :default => "$statedir/localconfig", :owner => "root", :mode => 0660, diff --git a/lib/puppet/transaction/report.rb b/lib/puppet/transaction/report.rb index 652b3874a..020a5efce 100644 --- a/lib/puppet/transaction/report.rb +++ b/lib/puppet/transaction/report.rb @@ -73,7 +73,7 @@ class Puppet::Transaction::Report @logs = [] @resource_statuses = {} @external_times ||= {} - @host = Puppet[:certname] + @host = Puppet[:node_name_value] @time = Time.now @kind = kind @report_format = 2 diff --git a/lib/puppet/util/settings/file_setting.rb b/lib/puppet/util/settings/file_setting.rb index edbab1d0c..776398ef4 100644 --- a/lib/puppet/util/settings/file_setting.rb +++ b/lib/puppet/util/settings/file_setting.rb @@ -101,6 +101,7 @@ class Puppet::Util::Settings::FileSetting < Puppet::Util::Settings::Setting resource[:ensure] = type resource[:loglevel] = :debug + resource[:links] = :follow resource[:backup] = false resource.tag(self.section, self.name, "settings") |
