Merge "Properly handle policy values containing spaces"
This commit is contained in:
@@ -37,7 +37,7 @@ define openstacklib::policy::base (
|
|||||||
augeas { "${file_path}-${key}-${value}" :
|
augeas { "${file_path}-${key}-${value}" :
|
||||||
lens => 'Json.lns',
|
lens => 'Json.lns',
|
||||||
incl => $file_path,
|
incl => $file_path,
|
||||||
changes => "set dict/entry[*][.=\"${key}\"]/string ${value}",
|
changes => "set dict/entry[*][.=\"${key}\"]/string \"${value}\"",
|
||||||
require => Augeas["${file_path}-${key}-${value}-add"]
|
require => Augeas["${file_path}-${key}-${value}-add"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,28 +8,28 @@ describe 'openstacklib::policy::base' do
|
|||||||
|
|
||||||
let :params do
|
let :params do
|
||||||
{:file_path => '/etc/nova/policy.json',
|
{:file_path => '/etc/nova/policy.json',
|
||||||
:key => 'context_is_admin',
|
:key => 'context_is_admin or owner',
|
||||||
:value => 'foo:bar'}
|
:value => 'foo:bar'}
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'configures the proper policy' do
|
it 'configures (modifies) the proper policy' do
|
||||||
should contain_augeas('/etc/nova/policy.json-context_is_admin-foo:bar').with(
|
should contain_augeas('/etc/nova/policy.json-context_is_admin or owner-foo:bar').with(
|
||||||
'lens' => 'Json.lns',
|
'lens' => 'Json.lns',
|
||||||
'incl' => '/etc/nova/policy.json',
|
'incl' => '/etc/nova/policy.json',
|
||||||
'changes' => 'set dict/entry[*][.="context_is_admin"]/string foo:bar',
|
'changes' => 'set dict/entry[*][.="context_is_admin or owner"]/string "foo:bar"',
|
||||||
'require' => 'Augeas[/etc/nova/policy.json-context_is_admin-foo:bar-add]'
|
'require' => 'Augeas[/etc/nova/policy.json-context_is_admin or owner-foo:bar-add]'
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'configures the proper policy' do
|
it 'configures (adds) the proper policy' do
|
||||||
should contain_augeas('/etc/nova/policy.json-context_is_admin-foo:bar-add').with(
|
should contain_augeas('/etc/nova/policy.json-context_is_admin or owner-foo:bar-add').with(
|
||||||
'lens' => 'Json.lns',
|
'lens' => 'Json.lns',
|
||||||
'incl' => '/etc/nova/policy.json',
|
'incl' => '/etc/nova/policy.json',
|
||||||
'changes' => [
|
'changes' => [
|
||||||
'set dict/entry[last()+1] "context_is_admin"',
|
'set dict/entry[last()+1] "context_is_admin or owner"',
|
||||||
'set dict/entry[last()]/string "foo:bar"'
|
'set dict/entry[last()]/string "foo:bar"'
|
||||||
],
|
],
|
||||||
'onlyif' => 'match dict/entry[*][.="context_is_admin"] size == 0'
|
'onlyif' => 'match dict/entry[*][.="context_is_admin or owner"] size == 0'
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user