Files
puppet-nova/spec/classes/nova_metadata_novajoin_policy_spec.rb
Martin Schuppert d7c27f5051 Delete policy file if policies hash is empty
If all policies get deleted, previously created policy files won't
get removed and the api policy file is still used. Let's make
sure the policy file gets purged if the policies hash is empty.

Depends-On: https://review.opendev.org/802305
Change-Id: Ic9b5ccd8fc23f6cebc06f62d972b64efd2400396
2021-08-30 14:14:12 +00:00

50 lines
1.2 KiB
Ruby

require 'spec_helper'
describe 'nova::metadata::novajoin::policy' do
shared_examples_for 'novajoin policies' do
let :params do
{
:policy_path => '/etc/novajoin/policy.yaml',
:policies => {
'context_is_admin' => {
'key' => 'context_is_admin',
'value' => 'foo:bar'
}
}
}
end
it 'set up the policies' do
is_expected.to contain_openstacklib__policy('/etc/novajoin/policy.yaml').with(
:policies => {
'context_is_admin' => {
'key' => 'context_is_admin',
'value' => 'foo:bar'
}
},
:policy_path => '/etc/novajoin/policy.yaml',
:file_user => 'root',
:file_format => 'yaml',
:purge_config => false,
)
is_expected.to contain_oslo__policy('novajoin_config').with(
:policy_file => '/etc/novajoin/policy.yaml',
)
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'novajoin policies'
end
end
end