Takashi Kajinami 1feab68bfa Use yaml instead of json for policy file
Because usage of json for policy file will be deprecated and replaced
by yaml[1].

[1] https://governance.openstack.org/tc/goals/selected/wallaby/migrate-policy-format-from-json-to-yaml.html

Depends-on: https://review.opendev.org/769647
Change-Id: I44aefbc366b549ad7ad73391a5d41cd151a66f62
2021-01-07 23:07:38 +00:00

47 lines
1.0 KiB
Puppet

# == Class: zaqar::policy
#
# Configure the zaqar policies
#
# === Parameters
#
# [*policies*]
# (Optional) Set of policies to configure for zaqar
# Example :
# {
# 'zaqar-context_is_admin' => {
# 'key' => 'context_is_admin',
# 'value' => 'true'
# },
# 'zaqar-default' => {
# 'key' => 'default',
# 'value' => 'rule:admin_or_owner'
# }
# }
# Defaults to empty hash.
#
# [*policy_path*]
# (Optional) Path to the zaqar policy.yaml file
# Defaults to /etc/zaqar/policy.yaml
#
class zaqar::policy (
$policies = {},
$policy_path = '/etc/zaqar/policy.yaml',
) {
include zaqar::deps
include zaqar::params
validate_legacy(Hash, 'validate_hash', $policies)
Openstacklib::Policy::Base {
file_path => $policy_path,
file_user => 'root',
file_group => $::zaqar::params::group,
file_format => 'yaml',
}
create_resources('openstacklib::policy::base', $policies)
oslo::policy { 'zaqar_config': policy_file => $policy_path }
}