
- This changes the puppet-lint requirement to 1.1.x, so that we can use puppet-lint plugins. Most of these plugins are for 4.x compat, but some just catch common errors. Change-Id: I4f96d4dc285bd6aa0ae5e4294ccd730cc4ee5c45 Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
46 lines
1.1 KiB
Puppet
46 lines
1.1 KiB
Puppet
# == Definition: openstacklib::policy::base
|
|
#
|
|
# This resource configures the policy.json file for an OpenStack service
|
|
#
|
|
# == Parameters:
|
|
#
|
|
# [*file_path*]
|
|
# Path to the policy.json file
|
|
# string; required
|
|
#
|
|
# [*key*]
|
|
# The key to replace the value for
|
|
# string; required; the key to replace the value for
|
|
#
|
|
# [*value*]
|
|
# The value to set
|
|
# string; optional; the value to set
|
|
#
|
|
define openstacklib::policy::base (
|
|
$file_path,
|
|
$key,
|
|
$value = '',
|
|
) {
|
|
|
|
# Add entry if it doesn't exists
|
|
augeas { "${file_path}-${key}-${value}-add":
|
|
lens => 'Json.lns',
|
|
incl => $file_path,
|
|
changes => [
|
|
"set dict/entry[last()+1] \"${key}\"",
|
|
"set dict/entry[last()]/string \"${value}\"",
|
|
],
|
|
onlyif => "match dict/entry[*][.=\"${key}\"] size == 0",
|
|
}
|
|
|
|
# Requires that the entry is added before this call or it will fail.
|
|
augeas { "${file_path}-${key}-${value}" :
|
|
lens => 'Json.lns',
|
|
incl => $file_path,
|
|
changes => "set dict/entry[*][.=\"${key}\"]/string \"${value}\"",
|
|
require => Augeas["${file_path}-${key}-${value}-add"],
|
|
}
|
|
|
|
}
|
|
|