summaryrefslogtreecommitdiffstats
path: root/acceptance
diff options
context:
space:
mode:
authorNick Lewis <nick@puppetlabs.com>2011-06-02 16:16:12 -0700
committerNick Lewis <nick@puppetlabs.com>2011-06-06 15:48:58 -0700
commitcd4fe148aae923f1167a3db450b64ead87418018 (patch)
tree84f24295a1767b6bad7daceae012147152186902 /acceptance
parenta00fd25547db6dec8fcd57a004fbec58324ce3dc (diff)
downloadpuppet-cd4fe148aae923f1167a3db450b64ead87418018.tar.gz
puppet-cd4fe148aae923f1167a3db450b64ead87418018.tar.xz
puppet-cd4fe148aae923f1167a3db450b64ead87418018.zip
(#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
Diffstat (limited to 'acceptance')
-rw-r--r--acceptance/tests/allow_arbitrary_node_name_for_agent.rb29
-rw-r--r--acceptance/tests/allow_arbitrary_node_name_for_apply.rb17
2 files changed, 46 insertions, 0 deletions
diff --git a/acceptance/tests/allow_arbitrary_node_name_for_agent.rb b/acceptance/tests/allow_arbitrary_node_name_for_agent.rb
new file mode 100644
index 000000000..f5e027660
--- /dev/null
+++ b/acceptance/tests/allow_arbitrary_node_name_for_agent.rb
@@ -0,0 +1,29 @@
+test_name "node_name_value should be used as the node name for puppet agent"
+
+success_message = "node_name_value setting was correctly used as the node name"
+
+authfile = "/tmp/auth.conf-2128-#{$$}"
+create_remote_file master, authfile, <<AUTHCONF
+path /catalog/specified_node_name
+auth yes
+allow *
+AUTHCONF
+
+manifest_file = "/tmp/node_name_value-test-#{$$}.pp"
+create_remote_file master, manifest_file, <<MANIFEST
+ Exec { path => "/usr/bin:/bin" }
+ node default {
+ exec { "false": }
+ }
+ node specified_node_name {
+ exec { "echo #{success_message}": }
+ }
+MANIFEST
+
+on master, "chmod 644 #{authfile} #{manifest_file}"
+
+with_master_running_on(master, "--rest_authconfig #{authfile} --manifest #{manifest_file} --daemonize --autosign true") do
+ run_agent_on(agents, "--no-daemonize --verbose --onetime --node_name_value specified_node_name --server #{master}") do
+ assert_match(success_message, stdout)
+ end
+end
diff --git a/acceptance/tests/allow_arbitrary_node_name_for_apply.rb b/acceptance/tests/allow_arbitrary_node_name_for_apply.rb
new file mode 100644
index 000000000..4daa8a65b
--- /dev/null
+++ b/acceptance/tests/allow_arbitrary_node_name_for_apply.rb
@@ -0,0 +1,17 @@
+test_name "node_name_value should be used as the node name for puppet apply"
+
+success_message = "node_name_value setting was correctly used as the node name"
+
+manifest = %Q[
+ Exec { path => "/usr/bin:/bin" }
+ node default {
+ exec { "false": }
+ }
+ node a_different_node_name {
+ exec { "echo #{success_message}": }
+ }
+]
+
+on agents, puppet_apply("--verbose --node_name_value a_different_node_name"), :stdin => manifest do
+ assert_match(success_message, stdout)
+end