|
| 1 | +# test for https://github.com/OpenVoxProject/openvox-agent/issues/66 |
| 2 | +test_name 'Warning about implementatin during puppet lookup' do |
| 3 | + require 'puppet/acceptance/puppet_type_test_tools.rb' |
| 4 | + extend Puppet::Acceptance::PuppetTypeTestTools |
| 5 | + |
| 6 | +# bastelfreak: I've no idea what those tags do, I copied them from lookup/v4_hieradata_with_v5_configs.rb |
| 7 | +tag 'audit:high', |
| 8 | + 'audit:acceptance', |
| 9 | + 'audit:refactor', # Master is not needed for this test. Refactor |
| 10 | + # to use puppet apply with a local module tree. |
| 11 | + |
| 12 | + app_type = File.basename(__FILE__, '.*') |
| 13 | + tmp_environment = mk_tmp_environment_with_teardown(master, app_type) |
| 14 | + fq_tmp_environmentpath = "#{environmentpath}/#{tmp_environment}" |
| 15 | + |
| 16 | + confdir = puppet_config(master, 'confdir', section: 'master') |
| 17 | + hiera_conf_backup = master.tmpfile('66-hiera-yaml') |
| 18 | + |
| 19 | + step "backup global hiera.yaml" do |
| 20 | + on(master, "cp -a #{confdir}/hiera.yaml #{hiera_conf_backup}", :acceptable_exit_codes => [0,1]) |
| 21 | + end |
| 22 | + |
| 23 | + teardown do |
| 24 | + step "restore global hiera.yaml" do |
| 25 | + on(master, "mv #{hiera_conf_backup} #{confdir}/hiera.yaml", :acceptable_exit_codes => [0,1]) |
| 26 | + end |
| 27 | + |
| 28 | + agents.each do |agent| |
| 29 | + on(agent, puppet('config print lastrunfile')) do |command_result| |
| 30 | + agent.rm_rf(command_result.stdout) |
| 31 | + end |
| 32 | + end |
| 33 | + end |
| 34 | + |
| 35 | + step "create global hiera.yaml and data" do |
| 36 | + create_remote_file(master, "#{confdir}/hiera.yaml", <<-HIERA) |
| 37 | +--- |
| 38 | +version: 5 |
| 39 | +hierarchy: |
| 40 | + - name: common |
| 41 | + data_hash: yaml_data |
| 42 | + path: "common.yaml" |
| 43 | + HIERA |
| 44 | + on(master, "chmod 755 #{confdir}/hiera.yaml") |
| 45 | + create_remote_file(master, "#{confdir}/common.yaml", <<-YAML) |
| 46 | +--- |
| 47 | +environment_key: environment_key-global_common_file |
| 48 | +global_key: global_key-global_common_file |
| 49 | + YAML |
| 50 | + end |
| 51 | + |
| 52 | + step 'assert lookups using lookup subcommand' do |
| 53 | + on(master, puppet('lookup', 'environment_key'), :accept_all_exit_codes => true) do |result| |
| 54 | + assert_match(/Warning: The node parameter 'implementation' for node '.*' was already set to 'openvox'. It could not be set to 'openvox'/, result.stderr) |
| 55 | + end |
| 56 | + end |
| 57 | +end |
0 commit comments