diff --git a/acceptance/tests/allow_arbitrary_node_name_fact_for_agent.rb b/acceptance/tests/allow_arbitrary_node_name_fact_for_agent.rb index c08c2e9a5..a8bf06a13 100644 --- a/acceptance/tests/allow_arbitrary_node_name_fact_for_agent.rb +++ b/acceptance/tests/allow_arbitrary_node_name_fact_for_agent.rb @@ -1,48 +1,46 @@ test_name "node_name_fact should be used to determine the node name for puppet agent" success_message = "node_name_fact setting was correctly used to determine the node name" node_names = [] on agents, facter('kernel') do node_names << stdout.chomp end node_names.uniq! authfile = "/tmp/auth.conf-2128-#{$$}" authconf = node_names.map do |node_name| %Q[ path /catalog/#{node_name} auth yes allow * ] end.join("\n") manifest_file = "/tmp/node_name_value-test-#{$$}.pp" manifest = %Q[ Exec { path => "/usr/bin:/bin" } node default { exec { "false": } } ] manifest << node_names.map do |node_name| %Q[ node "#{node_name}" { exec { "echo #{success_message}": } } ] end.join("\n") create_remote_file master, authfile, authconf create_remote_file master, manifest_file, manifest on master, "chmod 644 #{authfile} #{manifest_file}" -on hosts, "rm -rf /etc/puppet/ssl" - with_master_running_on(master, "--rest_authconfig #{authfile} --manifest #{manifest_file} --daemonize --dns_alt_names=\"puppet, $(hostname -s), $(hostname -f)\" --autosign true") do run_agent_on(agents, "--no-daemonize --verbose --onetime --node_name_fact kernel --server #{master}") do assert_match(success_message, stdout) end end diff --git a/acceptance/tests/allow_arbitrary_node_name_for_agent.rb b/acceptance/tests/allow_arbitrary_node_name_for_agent.rb index f35c32bc3..46c22a878 100644 --- a/acceptance/tests/allow_arbitrary_node_name_for_agent.rb +++ b/acceptance/tests/allow_arbitrary_node_name_for_agent.rb @@ -1,31 +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, < "/usr/bin:/bin" } node default { exec { "false": } } node specified_node_name { exec { "echo #{success_message}": } } MANIFEST on master, "chmod 644 #{authfile} #{manifest_file}" -on hosts, "rm -rf /etc/puppet/ssl" - with_master_running_on(master, "--rest_authconfig #{authfile} --manifest #{manifest_file} --daemonize --dns_alt_names=\"puppet, $(hostname -s), $(hostname -f)\" --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/helpful_error_message_when_hostname_not_match_server_certificate.rb b/acceptance/tests/helpful_error_message_when_hostname_not_match_server_certificate.rb index 6b0566e01..8b64436b6 100644 --- a/acceptance/tests/helpful_error_message_when_hostname_not_match_server_certificate.rb +++ b/acceptance/tests/helpful_error_message_when_hostname_not_match_server_certificate.rb @@ -1,12 +1,9 @@ test_name "generate a helpful error message when hostname doesn't match server certificate" -step "Clear any existing SSL directories" -on(hosts, "rm -rf #{config['puppetpath']}/ssl") - # Start the master with a certname not matching its hostname with_master_running_on(master, "--certname foobar_not_my_hostname --dns_alt_names one_cert,two_cert,red_cert,blue_cert --autosign true") do run_agent_on(agents, "--no-daemonize --verbose --onetime --server #{master}", :acceptable_exit_codes => (1..255)) do msg = "Server hostname '#{master}' did not match server certificate; expected one of foobar_not_my_hostname, DNS:blue_cert, DNS:foobar_not_my_hostname, DNS:one_cert, DNS:red_cert, DNS:two_cert" assert_match(msg, stdout) end end diff --git a/acceptance/tests/ticket_3360_allow_duplicate_csr_with_option_set.rb b/acceptance/tests/ticket_3360_allow_duplicate_csr_with_option_set.rb index edd52b46c..005141e0a 100644 --- a/acceptance/tests/ticket_3360_allow_duplicate_csr_with_option_set.rb +++ b/acceptance/tests/ticket_3360_allow_duplicate_csr_with_option_set.rb @@ -1,48 +1,45 @@ test_name "#3360: Allow duplicate CSR when allow_duplicate_certs is on" agent_hostnames = agents.map {|a| a.to_s} -step "Remove existing SSL directory for hosts" -on hosts, "rm -r #{config['puppetpath']}/ssl" - with_master_running_on master, "--allow_duplicate_certs --dns_alt_names=\"puppet,$(hostname -s),$(hostname -f)\" --verbose --noop" do step "Generate a certificate request for the agent" on agents, "puppet certificate generate `hostname -f` --ca-location remote --server #{master}" step "Collect the original certs" on master, puppet_cert("--sign --all") original_certs = on master, puppet_cert("--list --all") old_certs = {} original_certs.stdout.each_line do |line| if line =~ /^\+ (\S+) \((.+)\)$/ old_certs[$1] = $2 puts "old cert: #{$1} #{$2}" end end step "Make another request with the same certname" on agents, "puppet certificate generate `hostname -f` --ca-location remote --server #{master}" step "Collect the new certs" on master, puppet_cert("--sign --all") new_cert_list = on master, puppet_cert("--list --all") new_certs = {} new_cert_list.stdout.each_line do |line| if line =~ /^\+ (\S+) \((.+)\)$/ new_certs[$1] = $2 puts "new cert: #{$1} #{$2}" end end step "Verify the certs have changed" # using the agent name as the key may cause errors; # agent name from cfg file is likely to have short name # where certs might be signed with long names. old_certs.each_key { |key| next if key.include? master # skip the masters cert, only care about agents assert_not_equal(old_certs[key], new_certs[key], "Expected #{key} to have a changed key") } end diff --git a/acceptance/tests/ticket_5477_master_not_dectect_sitepp.rb b/acceptance/tests/ticket_5477_master_not_dectect_sitepp.rb index 347b5991f..30ac77d13 100644 --- a/acceptance/tests/ticket_5477_master_not_dectect_sitepp.rb +++ b/acceptance/tests/ticket_5477_master_not_dectect_sitepp.rb @@ -1,34 +1,33 @@ # In 2.6, compile does not fail when site.pp does not exist. # # However, if a catalog is compiled when site.pp does not exist, # puppetmaster does not detect when site.pp is created. This requires a restart # test_name "Ticket 5477, Puppet Master does not detect newly created site.pp file" manifest_file = "/tmp/missing_site-5477-#{$$}.pp" on master, "rm -f #{manifest_file}" -on hosts, "rm -rf /etc/puppet/ssl" with_master_running_on(master, "--manifest #{manifest_file} --dns_alt_names=\"puppet, $(hostname -s), $(hostname -f)\" --verbose --filetimeout 1 --autosign true") do # Run test on Agents step "Agent: agent --test" on agents, puppet_agent("--test --server #{master}") # Create a new site.pp step "Master: create basic site.pp file" create_remote_file master, manifest_file, "notify{ticket_5477_notify:}" on master, "chmod 644 #{manifest_file}" sleep 3 step "Agent: puppet agent --test" agents.each do |host| on(host, puppet_agent("--test --server #{master}"), :acceptable_exit_codes => [2]) do assert_match(/ticket_5477_notify/, stdout, "#{host}: Site.pp not detected on Puppet Master") end end end diff --git a/acceptance/tests/ticket_7117_broke_env_criteria_authconf.rb b/acceptance/tests/ticket_7117_broke_env_criteria_authconf.rb index eda6ae3de..bb0b0ab8c 100644 --- a/acceptance/tests/ticket_7117_broke_env_criteria_authconf.rb +++ b/acceptance/tests/ticket_7117_broke_env_criteria_authconf.rb @@ -1,29 +1,27 @@ test_name "#7117 Broke the environment criteria in auth.conf" # add to auth.conf add_2_authconf = %q{ path / environment override auth any allow * } step "Create a temp auth.conf" create_remote_file master, "/tmp/auth.conf-7117", add_2_authconf on master, "chmod 644 /tmp/auth.conf-7117" -on hosts, "rm -rf /etc/puppet/ssl" - with_master_running_on(master, "--dns_alt_names=\"puppet, $(hostname -s), $(hostname -f)\" --rest_authconfig /tmp/auth.conf-7117 --verbose --autosign true") do # Run test on Agents step "Run agent to upload facts" on agents, puppet_agent("--test --server #{master}") step "Fetch agent facts from Puppet Master" agents.each do |host| on(host, "curl -k -H \"Accept: yaml\" https://#{master}:8140/override/facts/\`hostname -f\`") do assert_match(/--- !ruby\/object:Puppet::Node::Facts/, stdout, "Agent Facts not returned for #{host}") end end end