diff --git a/manifests/policy/base.pp b/manifests/policy/base.pp index 92baebc4..81b247ce 100644 --- a/manifests/policy/base.pp +++ b/manifests/policy/base.pp @@ -61,7 +61,7 @@ define openstacklib::policy::base ( warning('Json format is deprecated and will be removed in a future release') # Add entry if it doesn't exists - augeas { "${file_path}-${key}-${value}-add": + augeas { "${file_path}-${key}-add": lens => 'Json.lns', incl => $file_path, changes => [ @@ -72,15 +72,15 @@ define openstacklib::policy::base ( } # Requires that the entry is added before this call or it will fail. - augeas { "${file_path}-${key}-${value}" : + augeas { "${file_path}-${key}" : lens => 'Json.lns', incl => $file_path, changes => "set dict/entry[*][.=\"${key}\"]/string \"${value}\"", } Openstacklib::Policy::Default<| title == $file_path |> - -> Augeas<| title == "${file_path}-${key}-${value}-add" |> - ~> Augeas<| title == "${file_path}-${key}-${value}" |> + -> Augeas<| title == "${file_path}-${key}-add" |> + ~> Augeas<| title == "${file_path}-${key}" |> } 'yaml': { # NOTE(tkajianm): Currently we use single quotes('') to quote the whole diff --git a/spec/defines/openstacklib_policy_base_spec.rb b/spec/defines/openstacklib_policy_base_spec.rb index 5b0f7235..c15d07ae 100644 --- a/spec/defines/openstacklib_policy_base_spec.rb +++ b/spec/defines/openstacklib_policy_base_spec.rb @@ -27,13 +27,13 @@ describe 'openstacklib::policy::base' do :purge_config => false, )} - it { should contain_augeas('/etc/nova/policy.json-context_is_admin or owner-foo:bar').with( + it { should contain_augeas('/etc/nova/policy.json-context_is_admin or owner').with( :lens => 'Json.lns', :incl => '/etc/nova/policy.json', :changes => 'set dict/entry[*][.="context_is_admin or owner"]/string "foo:bar"', )} - it { should contain_augeas('/etc/nova/policy.json-context_is_admin or owner-foo:bar-add').with( + it { should contain_augeas('/etc/nova/policy.json-context_is_admin or owner-add').with( :lens => 'Json.lns', :incl => '/etc/nova/policy.json', :changes => [