1 # == Definition: openstacklib::policy::base
3 # This resource configures the policy.json file for an OpenStack service
8 # Path to the policy.json file
12 # The key to replace the value for
13 # string; required; the key to replace the value for
17 # string; optional; the value to set
19 define openstacklib::policy::base (
25 # Add entry if it doesn't exists
26 augeas { "${file_path}-${key}-${value}-add":
30 "set dict/entry[last()+1] \"${key}\"",
31 "set dict/entry[last()]/string \"${value}\"",
33 onlyif => "match dict/entry[*][.=\"${key}\"] size == 0",
36 # Requires that the entry is added before this call or it will fail.
37 augeas { "${file_path}-${key}-${value}" :
40 changes => "set dict/entry[*][.=\"${key}\"]/string \"${value}\"",
41 require => Augeas["${file_path}-${key}-${value}-add"],