Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'zaphod42/bug/2.7.x/8174-incorrect-warni…
…ng-about-deprecated-scoping' into 2.7.x * zaphod42/bug/2.7.x/8174-incorrect-warning-about-deprecated-scoping: Fixed old log test to match new autoflush behavior Make sure the log file writable Default autoflushing of log files to true Created test that shows enc warning problem Increased test coverage of scoping rules Use more descriptive terms for the differing scopes Make new scoping look through inherited scopes Add tests for mixed inheritence/inclusion Remove dynamic option for lookupvar Implement newlookupvar() to replace dynamic scope Tests for deprecation warnings for dynamic scoping
- Loading branch information
Showing
8 changed files
with
414 additions
and
36 deletions.
There are no files selected for viewing
80 changes: 80 additions & 0 deletions
80
acceptance/tests/language/ticket_8174_enc_causes_spurious_deprecation_warnings.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,80 @@ | |||
test_name "#8174: incorrect warning about deprecated scoping" | |||
|
|||
testdir = master.tmpdir('scoping_deprecation') | |||
|
|||
create_remote_file(master, "#{testdir}/puppet.conf", <<END) | |||
[main] | |||
node_terminus = exec | |||
external_nodes = "#{testdir}/enc" | |||
manifest = "#{testdir}/site.pp" | |||
modulepath = "#{testdir}/modules" | |||
END | |||
|
|||
on master, "mkdir -p #{testdir}/modules/a/manifests" | |||
|
|||
create_remote_file(master, "#{testdir}/enc", <<-PP) | |||
#!/usr/bin/env sh | |||
cat <<END | |||
--- | |||
classes: | |||
a | |||
parameters: | |||
enc_var: "Set from ENC." | |||
END | |||
exit 0 | |||
PP | |||
|
|||
create_remote_file(master, "#{testdir}/site.pp", <<-PP) | |||
$top_scope = "set from site.pp" | |||
node default { | |||
$node_var = "in node" | |||
} | |||
PP | |||
create_remote_file(master, "#{testdir}/modules/a/manifests/init.pp", <<-PP) | |||
class a { | |||
$locally = "locally declared" | |||
$dynamic_for_b = "dynamic and declared in a" | |||
notify { "fqdn from facts": message => $fqdn } | |||
notify { "locally declared var": message => $locally } | |||
notify { "var via enc": message => $enc_var } | |||
notify { "declared top scope": message => $top_scope } | |||
notify { "declared node": message => $node_var } | |||
include a::b | |||
} | |||
PP | |||
create_remote_file(master, "#{testdir}/modules/a/manifests/b.pp", <<-PP) | |||
class a::b { | |||
notify { "dynamic from elsewhere": message => $dynamic_for_b } | |||
} | |||
PP | |||
|
|||
on master, "chown -R root:puppet #{testdir}" | |||
on master, "chmod -R g+rwX #{testdir}" | |||
on master, "chmod -R a+x #{testdir}/enc" | |||
on master, "touch #{testdir}/log" | |||
on master, "chown puppet #{testdir}/log" | |||
|
|||
assert_log_on_master_contains = lambda do |string| | |||
on master, "grep '#{string}' #{testdir}/log" | |||
end | |||
|
|||
assert_log_on_master_does_not_contain = lambda do |string| | |||
on master, "grep -v '#{string}' #{testdir}/log" | |||
end | |||
|
|||
with_master_running_on(master, "--config #{testdir}/puppet.conf --debug --verbose --daemonize --dns_alt_names=\"puppet,$(hostname -s),$(hostname -f)\" --autosign true --logdest #{testdir}/log") do | |||
agents.each do |agent| | |||
run_agent_on(agent, "--no-daemonize --onetime --server #{master}") | |||
end | |||
|
|||
assert_log_on_master_contains['Dynamic lookup of $dynamic_for_b'] | |||
assert_log_on_master_does_not_contain['Dynamic lookup of $fqdn'] | |||
assert_log_on_master_does_not_contain['Dynamic lookup of $locally'] | |||
assert_log_on_master_does_not_contain['Dynamic lookup of $enc_var'] | |||
assert_log_on_master_does_not_contain['Dynamic lookup of $top_scope'] | |||
assert_log_on_master_does_not_contain['Dynamic lookup of $node_var'] | |||
end | |||
|
|||
on master, "rm -rf #{testdir}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.