Skip to content

Commit 5084758

Browse files
authored
Merge pull request #8991 from joshcooper/ruby32_beaker_11713
(PUP-11713) Update beaker tests to use structured facts
2 parents be8e166 + 7dbc49b commit 5084758

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

acceptance/tests/catalog_with_binary_data.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
manifest = <<-MANIFEST
4343
class #{test_num}(
4444
) {
45-
\$test_path = \$::fqdn ? #{agent_tmp_dirs}
45+
\$test_path = \$facts['networking']['fqdn'] ? #{agent_tmp_dirs}
4646
file { '#{test_num}':
4747
path => "\$test_path/#{test_num}",
4848
content => file('#{test_num}/binary_data'),

acceptance/tests/direct_puppet/supports_utf8.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
file { '#{environmentpath}/#{tmp_environment}/manifests/site.pp':
4242
ensure => file,
4343
content => '
44-
\$test_path = \$::fqdn ? #{tmp_file}
44+
\$test_path = \$facts["networking"]["fqdn"] ? #{tmp_file}
4545
file { \$test_path:
4646
content => @(UTF8)
4747
#{file_contents}

acceptance/tests/parser_functions/hiera_in_templates.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def create_environment(osfamilies, tmp_dirs)
100100
\\$msgs = hiera_array('message')
101101
notify {\\$msgs:}
102102
class {'#{@module_name}':
103-
result_dir => hiera('result_dir')[\\$::hostname],
103+
result_dir => hiera('result_dir')[\\$facts['networking']['hostname']],
104104
}
105105
}
106106
",
@@ -119,7 +119,7 @@ class {'#{@module_name}':
119119
:hierarchy:
120120
- \\"%{clientcert}\\"
121121
- \\"%{environment}\\"
122-
- \\"%{osfamily}\\"
122+
- \\"%{os.family}\\"
123123
- \\"default\\"
124124
"
125125
}
@@ -188,7 +188,7 @@ class #{@module_name} (
188188
file { "#{moduledir}/manifests/mod_default.pp":
189189
content => "
190190
class #{@module_name}::mod_default {
191-
\\$result_dir = hiera('result_dir')[\\$::hostname]
191+
\\$result_dir = hiera('result_dir')[\\$facts['networking']['hostname']]
192192
notify{\\"module mod_default invoked.\\\\n\\":}
193193
file {\\\"\\\${result_dir}/mod_default\\\":
194194
ensure => 'file',
@@ -202,7 +202,7 @@ class #{@module_name}::mod_default {
202202
file { "#{moduledir}/manifests/mod_osfamily.pp":
203203
content => "
204204
class #{@module_name}::mod_osfamily {
205-
\\$result_dir = hiera('result_dir')[\\$::hostname]
205+
\\$result_dir = hiera('result_dir')[\\$facts['networking']['hostname']]
206206
notify{\\"module mod_osfamily invoked.\\\\n\\":}
207207
file {\\\"\\\${result_dir}/mod_osfamily\\\":
208208
ensure => 'file',
@@ -216,7 +216,7 @@ class #{@module_name}::mod_osfamily {
216216
file { "#{moduledir}/manifests/mod_production.pp":
217217
content => "
218218
class #{@module_name}::mod_production {
219-
\\$result_dir = hiera('result_dir')[\\$::hostname]
219+
\\$result_dir = hiera('result_dir')[\\$facts['networking']['hostname']]
220220
notify{\\"module mod_production invoked.\\\\n\\":}
221221
file {\\\"\\\${result_dir}/mod_production\\\":
222222
ensure => 'file',
@@ -230,7 +230,7 @@ class #{@module_name}::mod_production {
230230
file { "#{moduledir}/manifests/mod_fqdn.pp":
231231
content => "
232232
class #{@module_name}::mod_fqdn {
233-
\\$result_dir = hiera('result_dir')[\\$::hostname]
233+
\\$result_dir = hiera('result_dir')[\\$facts['networking']['hostname']]
234234
notify{\\"module mod_fqdn invoked.\\\\n\\":}
235235
file {\\\"\\\${result_dir}/mod_fqdn\\\":
236236
ensure => 'file',
@@ -271,7 +271,7 @@ class #{@module_name}::mod_fqdn {
271271
def find_osfamilies
272272
family_hash = {}
273273
agents.each do |agent|
274-
res = on(agent, facter("osfamily"))
274+
res = on(agent, facter("os.family"))
275275
osf = res.stdout.chomp
276276
family_hash[osf] = 1
277277
end
@@ -282,7 +282,7 @@ def find_tmp_dirs
282282
tmp_dirs = ""
283283
host_to_result_dir = {}
284284
agents.each do |agent|
285-
h = on(agent, facter("hostname")).stdout.chomp
285+
h = on(agent, facter("networking.hostname")).stdout.chomp
286286
t = agent.tmpdir("#{@module_name}_results")
287287
tmp_dirs += " #{h}: '#{t}'\n"
288288
host_to_result_dir[h] = t
@@ -304,7 +304,7 @@ def find_tmp_dirs
304304
env_manifest = create_environment(find_osfamilies, tmp_dirs)
305305
apply_manifest_on(master, env_manifest, :catch_failures => true)
306306
agents.each do |agent|
307-
resultdir = host_to_result_dir[on(agent, facter("hostname")).stdout.chomp]
307+
resultdir = host_to_result_dir[on(agent, facter("networking.hostname")).stdout.chomp]
308308
step "Applying catalog to agent: #{agent}. result files in #{resultdir}"
309309
on(
310310
agent,

acceptance/tests/reports/corrective_change_new_resource.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
file { '#{environmentpath}/#{tmp_environment}/manifests/site.pp':
4242
ensure => file,
4343
content => '
44-
\$test_path = \$::fqdn ? #{tmp_file}
44+
\$test_path = \$facts["networking"]["fqdn"] ? #{tmp_file}
4545
file { \$test_path:
4646
content => @(UTF8)
4747
#{file_contents}

acceptance/tests/reports/corrective_change_outside_puppet.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
file { '#{environmentpath}/#{tmp_environment}/manifests/site.pp':
4242
ensure => file,
4343
content => '
44-
\$test_path = \$::fqdn ? #{tmp_file}
44+
\$test_path = \$facts["networking"]["fqdn"] ? #{tmp_file}
4545
file { \$test_path:
4646
content => @(UTF8)
4747
#{file_contents}

acceptance/tests/reports/corrective_change_via_puppet.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def create_manifest_for_file_resource(file_resource, file_contents, environment_
4646
file { '#{environmentpath}/#{environment_name}/manifests/site.pp':
4747
ensure => file,
4848
content => '
49-
\$test_path = \$::fqdn ? #{file_resource}
49+
\$test_path = \$facts["networking"]["fqdn"] ? #{file_resource}
5050
file { \$test_path:
5151
content => @(UTF8)
5252
#{file_contents}

acceptance/tests/resource/file/ticket_6448_file_with_utf8_source.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
step 'create a site.pp on master containing a unicode file resource' do
5656
site_pp_contents = <<-SITE_PP
57-
\$test_path = \$::fqdn ? #{agent_tmp_dirs}
57+
\$test_path = \$facts['networking']['fqdn'] ? #{agent_tmp_dirs}
5858
file { "\$test_path/\uff72\uff67\u30d5\u30eb":
5959
ensure => present,
6060
source => "puppet:///modules/utf8_file_module/\u9759\u7684",

0 commit comments

Comments
 (0)