From 16b2311256a142a69cb9ddadf29eea804b281e1c Mon Sep 17 00:00:00 2001 From: Ben Hughes Date: Tue, 5 Apr 2011 16:19:01 +1000 Subject: (#6885) puppet agent fingerprint requires --verbose to return a value. Always output the fingerprint to STDOUT, no matter what loglevel is used, as that's the whole purpose of the comment. Having to specify --verbose in addition to --fingerprint to get the finger is nonsensical. Update the spec test to stub @puppet puts, instead of the Puppet.logging facilities. Reviewed-by: Daniel Pittman --- lib/puppet/application/agent.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/puppet/application') diff --git a/lib/puppet/application/agent.rb b/lib/puppet/application/agent.rb index 3749241f8..53e083232 100644 --- a/lib/puppet/application/agent.rb +++ b/lib/puppet/application/agent.rb @@ -98,7 +98,7 @@ class Puppet::Application::Agent < Puppet::Application 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 -- cgit From cd4fe148aae923f1167a3db450b64ead87418018 Mon Sep 17 00:00:00 2001 From: Nick Lewis Date: Thu, 2 Jun 2011 16:16:12 -0700 Subject: (#2128) Add the ability to specify a node name The setting node_name_value may now be used for 'puppet apply' or 'puppet agent' to specify the name for the node. This will not affect the certificate used by the node, and the node will still be authenticated based on its certname. The default value for node_name_value is the certname. This is useful for eg. EC2 nodes whose random hostnames cannot be easily used to classify them. Paired-With: Jacob Helwig --- lib/puppet/application/apply.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/puppet/application') diff --git a/lib/puppet/application/apply.rb b/lib/puppet/application/apply.rb index 7f0b95a89..3f423a4c4 100644 --- a/lib/puppet/application/apply.rb +++ b/lib/puppet/application/apply.rb @@ -85,13 +85,13 @@ class Puppet::Application::Apply < Puppet::Application end # Collect our facts. - unless facts = Puppet::Node::Facts.find(Puppet[:certname]) - raise "Could not find facts for #{Puppet[:certname]}" + unless facts = Puppet::Node::Facts.find(Puppet[:node_name_value]) + raise "Could not find facts for #{Puppet[:node_name_value]}" end # Find our Node - unless node = Puppet::Node.find(Puppet[:certname]) - raise "Could not find node #{Puppet[:certname]}" + unless node = Puppet::Node.find(Puppet[:node_name_value]) + raise "Could not find node #{Puppet[:node_name_value]}" end # Merge in the facts. -- cgit From 1c70f0ce54022b55119b9e2d6d60cd1ae9bc019e Mon Sep 17 00:00:00 2001 From: Nick Lewis Date: Thu, 2 Jun 2011 16:24:16 -0700 Subject: (#2128) Add support for setting node name based on a fact This adds the node_name_fact setting, which specifies a fact to use to determine the node name. This allows dynamically determining the node name without having to modify puppet.conf or command line options. Using this setting requires modifying auth.conf to allow nodes to request catalogs not matching their certnames. For example, this would allow any authenticated node to retrieve any catalog: # $confdir/auth.conf path ~ /catalog/.+ allow * The node_name_fact and node_name_value options are mutually exclusive, because it is ambiguous which setting should take precedence. Paired-With: Jacob Helwig --- lib/puppet/application/apply.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/puppet/application') diff --git a/lib/puppet/application/apply.rb b/lib/puppet/application/apply.rb index 3f423a4c4..717935640 100644 --- a/lib/puppet/application/apply.rb +++ b/lib/puppet/application/apply.rb @@ -89,6 +89,11 @@ class Puppet::Application::Apply < Puppet::Application 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.find(Puppet[:node_name_value]) raise "Could not find node #{Puppet[:node_name_value]}" -- cgit