~ubuntu-branches/ubuntu/quantal/puppet/quantal

« back to all changes in this revision

Viewing changes to acceptance/tests/allow_arbitrary_node_name_fact_for_agent.rb

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-07-14 01:56:30 UTC
  • mfrom: (1.1.29) (3.1.43 sid)
  • Revision ID: package-import@ubuntu.com-20120714015630-ntj41rkvkq4zph4y
Tags: 2.7.18-1ubuntu1
* Resynchronise with Debian. (LP: #1023931) Remaining changes:
  - debian/puppetmaster-passenger.postinst: Make sure we error if puppet
    config print doesn't work
  - debian/puppetmaster-passenger.postinst: Ensure upgrades from
    <= 2.7.11-1 fixup passenger apache configuration.
* Dropped upstreamed patches:
  - debian/patches/CVE-2012-1906_CVE-2012-1986_to_CVE-2012-1989.patch
  - debian/patches/puppet-12844
  - debian/patches/2.7.17-Puppet-July-2012-CVE-fixes.patch
* Drop Build-Depends on ruby-rspec (in universe):
  - debian/control: remove ruby-rspec from Build-Depends
  - debian/patches/no-rspec.patch: make Rakefile work anyway if rspec
    isn't installed so we can use it in debian/rules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
test_name "node_name_fact should be used to determine the node name for puppet agent"
2
 
 
3
 
success_message = "node_name_fact setting was correctly used to determine the node name"
4
 
 
5
 
node_names = []
6
 
 
7
 
on agents, facter('kernel') do
8
 
  node_names << stdout.chomp
9
 
end
10
 
 
11
 
node_names.uniq!
12
 
 
13
 
authfile = "/tmp/auth.conf-2128-#{$$}"
14
 
authconf = node_names.map do |node_name|
15
 
  %Q[
16
 
path /catalog/#{node_name}
17
 
auth yes
18
 
allow *
19
 
]
20
 
end.join("\n")
21
 
 
22
 
manifest_file = "/tmp/node_name_value-test-#{$$}.pp"
23
 
manifest = %Q[
24
 
  Exec { path => "/usr/bin:/bin" }
25
 
  node default {
26
 
    exec { "false": }
27
 
  }
28
 
]
29
 
manifest << node_names.map do |node_name|
30
 
  %Q[
31
 
    node "#{node_name}" {
32
 
      exec { "echo #{success_message}": }
33
 
    }
34
 
  ]
35
 
end.join("\n")
36
 
 
37
 
create_remote_file master, authfile, authconf
38
 
create_remote_file master, manifest_file, manifest
39
 
 
40
 
on master, "chmod 644 #{authfile} #{manifest_file}"
41
 
 
42
 
with_master_running_on(master, "--rest_authconfig #{authfile} --manifest #{manifest_file} --daemonize --dns_alt_names=\"puppet, $(hostname -s), $(hostname -f)\" --autosign true") do
43
 
  run_agent_on(agents, "--no-daemonize --verbose --onetime --node_name_fact kernel --server #{master}") do
44
 
    assert_match(success_message, stdout)
45
 
  end
46
 
end