Merge "Replace own hiera_undef function by built-in lookup"

This commit is contained in:
Zuul 2022-10-06 10:56:00 +00:00 committed by Gerrit Code Review
commit c85bd66dbe
2 changed files with 35 additions and 56 deletions

View File

@ -1,21 +0,0 @@
# Copyright (c) 2013 puppet@camptocamp.com All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
module Puppet::Parser::Functions
newfunction(:hiera_undef, :type => :rvalue) do |*args|
require 'hiera_puppet'
key, override = HieraPuppet.parse_args(args)
HieraPuppet.lookup(key, :undef, self, override, :priority)
end
end

View File

@ -71,48 +71,48 @@ class packstack::keystone ()
if lookup('CONFIG_KEYSTONE_IDENTITY_BACKEND') == 'ldap' { if lookup('CONFIG_KEYSTONE_IDENTITY_BACKEND') == 'ldap' {
if hiera_undef('CONFIG_KEYSTONE_LDAP_USER_ENABLED_EMULATION_DN', undef) { if lookup('CONFIG_KEYSTONE_LDAP_USER_ENABLED_EMULATION_DN', undef, undef, undef) {
$user_enabled_emulation = true $user_enabled_emulation = true
} else { } else {
$user_enabled_emulation = false $user_enabled_emulation = false
} }
class { 'keystone::ldap': class { 'keystone::ldap':
url => hiera_undef('CONFIG_KEYSTONE_LDAP_URL', undef), url => lookup('CONFIG_KEYSTONE_LDAP_URL', undef, undef, undef),
user => hiera_undef('CONFIG_KEYSTONE_LDAP_USER_DN', undef), user => lookup('CONFIG_KEYSTONE_LDAP_USER_DN', undef, undef, undef),
password => hiera_undef('CONFIG_KEYSTONE_LDAP_USER_PASSWORD', undef), password => lookup('CONFIG_KEYSTONE_LDAP_USER_PASSWORD', undef, undef, undef),
suffix => hiera_undef('CONFIG_KEYSTONE_LDAP_SUFFIX', undef), suffix => lookup('CONFIG_KEYSTONE_LDAP_SUFFIX', undef, undef, undef),
query_scope => hiera_undef('CONFIG_KEYSTONE_LDAP_QUERY_SCOPE', undef), query_scope => lookup('CONFIG_KEYSTONE_LDAP_QUERY_SCOPE', undef, undef, undef),
page_size => hiera_undef('CONFIG_KEYSTONE_LDAP_PAGE_SIZE', undef), page_size => lookup('CONFIG_KEYSTONE_LDAP_PAGE_SIZE', undef, undef, undef),
user_tree_dn => hiera_undef('CONFIG_KEYSTONE_LDAP_USER_SUBTREE', undef), user_tree_dn => lookup('CONFIG_KEYSTONE_LDAP_USER_SUBTREE', undef, undef, undef),
user_filter => hiera_undef('CONFIG_KEYSTONE_LDAP_USER_FILTER', undef), user_filter => lookup('CONFIG_KEYSTONE_LDAP_USER_FILTER', undef, undef, undef),
user_objectclass => hiera_undef('CONFIG_KEYSTONE_LDAP_USER_OBJECTCLASS', undef), user_objectclass => lookup('CONFIG_KEYSTONE_LDAP_USER_OBJECTCLASS', undef, undef, undef),
user_id_attribute => hiera_undef('CONFIG_KEYSTONE_LDAP_USER_ID_ATTRIBUTE', undef), user_id_attribute => lookup('CONFIG_KEYSTONE_LDAP_USER_ID_ATTRIBUTE', undef, undef, undef),
user_name_attribute => hiera_undef('CONFIG_KEYSTONE_LDAP_USER_NAME_ATTRIBUTE', undef), user_name_attribute => lookup('CONFIG_KEYSTONE_LDAP_USER_NAME_ATTRIBUTE', undef, undef, undef),
user_mail_attribute => hiera_undef('CONFIG_KEYSTONE_LDAP_USER_MAIL_ATTRIBUTE', undef), user_mail_attribute => lookup('CONFIG_KEYSTONE_LDAP_USER_MAIL_ATTRIBUTE', undef, undef, undef),
user_enabled_attribute => hiera_undef('CONFIG_KEYSTONE_LDAP_USER_ENABLED_ATTRIBUTE', undef), user_enabled_attribute => lookup('CONFIG_KEYSTONE_LDAP_USER_ENABLED_ATTRIBUTE', undef, undef, undef),
user_enabled_mask => hiera_undef('CONFIG_KEYSTONE_LDAP_USER_ENABLED_MASK', undef), user_enabled_mask => lookup('CONFIG_KEYSTONE_LDAP_USER_ENABLED_MASK', undef, undef, undef),
user_enabled_default => hiera_undef('CONFIG_KEYSTONE_LDAP_USER_ENABLED_DEFAULT', undef), user_enabled_default => lookup('CONFIG_KEYSTONE_LDAP_USER_ENABLED_DEFAULT', undef, undef, undef),
user_enabled_invert => hiera_undef('CONFIG_KEYSTONE_LDAP_USER_ENABLED_INVERT', undef), user_enabled_invert => lookup('CONFIG_KEYSTONE_LDAP_USER_ENABLED_INVERT', undef, undef, undef),
user_attribute_ignore => hiera_undef('CONFIG_KEYSTONE_LDAP_USER_ATTRIBUTE_IGNORE', undef), user_attribute_ignore => lookup('CONFIG_KEYSTONE_LDAP_USER_ATTRIBUTE_IGNORE', undef, undef, undef),
user_default_project_id_attribute => hiera_undef('CONFIG_KEYSTONE_LDAP_USER_DEFAULT_PROJECT_ID_ATTRIBUTE', undef), user_default_project_id_attribute => lookup('CONFIG_KEYSTONE_LDAP_USER_DEFAULT_PROJECT_ID_ATTRIBUTE', undef, undef, undef),
user_pass_attribute => hiera_undef('CONFIG_KEYSTONE_LDAP_USER_PASS_ATTRIBUTE', undef), user_pass_attribute => lookup('CONFIG_KEYSTONE_LDAP_USER_PASS_ATTRIBUTE', undef, undef, undef),
user_enabled_emulation => $user_enabled_emulation, user_enabled_emulation => $user_enabled_emulation,
user_enabled_emulation_dn => hiera_undef('CONFIG_KEYSTONE_LDAP_USER_ENABLED_EMULATION_DN', undef), user_enabled_emulation_dn => lookup('CONFIG_KEYSTONE_LDAP_USER_ENABLED_EMULATION_DN', undef, undef, undef),
user_additional_attribute_mapping => hiera_undef('CONFIG_KEYSTONE_LDAP_USER_ADDITIONAL_ATTRIBUTE_MAPPING', undef), user_additional_attribute_mapping => lookup('CONFIG_KEYSTONE_LDAP_USER_ADDITIONAL_ATTRIBUTE_MAPPING', undef, undef, undef),
group_tree_dn => hiera_undef('CONFIG_KEYSTONE_LDAP_GROUP_SUBTREE', undef), group_tree_dn => lookup('CONFIG_KEYSTONE_LDAP_GROUP_SUBTREE', undef, undef, undef),
group_filter => hiera_undef('CONFIG_KEYSTONE_LDAP_GROUP_FILTER', undef), group_filter => lookup('CONFIG_KEYSTONE_LDAP_GROUP_FILTER', undef, undef, undef),
group_objectclass => hiera_undef('CONFIG_KEYSTONE_LDAP_GROUP_OBJECTCLASS', undef), group_objectclass => lookup('CONFIG_KEYSTONE_LDAP_GROUP_OBJECTCLASS', undef, undef, undef),
group_id_attribute => hiera_undef('CONFIG_KEYSTONE_LDAP_GROUP_ID_ATTRIBUTE', undef), group_id_attribute => lookup('CONFIG_KEYSTONE_LDAP_GROUP_ID_ATTRIBUTE', undef, undef, undef),
group_name_attribute => hiera_undef('CONFIG_KEYSTONE_LDAP_GROUP_NAME_ATTRIBUTE', undef), group_name_attribute => lookup('CONFIG_KEYSTONE_LDAP_GROUP_NAME_ATTRIBUTE', undef, undef, undef),
group_member_attribute => hiera_undef('CONFIG_KEYSTONE_LDAP_GROUP_MEMBER_ATTRIBUTE', undef), group_member_attribute => lookup('CONFIG_KEYSTONE_LDAP_GROUP_MEMBER_ATTRIBUTE', undef, undef, undef),
group_desc_attribute => hiera_undef('CONFIG_KEYSTONE_LDAP_GROUP_DESC_ATTRIBUTE', undef), group_desc_attribute => lookup('CONFIG_KEYSTONE_LDAP_GROUP_DESC_ATTRIBUTE', undef, undef, undef),
group_attribute_ignore => hiera_undef('CONFIG_KEYSTONE_LDAP_GROUP_ATTRIBUTE_IGNORE', undef), group_attribute_ignore => lookup('CONFIG_KEYSTONE_LDAP_GROUP_ATTRIBUTE_IGNORE', undef, undef, undef),
group_additional_attribute_mapping => hiera_undef('CONFIG_KEYSTONE_LDAP_GROUP_ADDITIONAL_ATTRIBUTE_MAPPING', undef), group_additional_attribute_mapping => lookup('CONFIG_KEYSTONE_LDAP_GROUP_ADDITIONAL_ATTRIBUTE_MAPPING', undef, undef, undef),
use_tls => hiera_undef('CONFIG_KEYSTONE_LDAP_USE_TLS', undef), use_tls => lookup('CONFIG_KEYSTONE_LDAP_USE_TLS', undef, undef, undef),
tls_cacertdir => hiera_undef('CONFIG_KEYSTONE_LDAP_TLS_CACERTDIR', undef), tls_cacertdir => lookup('CONFIG_KEYSTONE_LDAP_TLS_CACERTDIR', undef, undef, undef),
tls_cacertfile => hiera_undef('CONFIG_KEYSTONE_LDAP_TLS_CACERTFILE', undef), tls_cacertfile => lookup('CONFIG_KEYSTONE_LDAP_TLS_CACERTFILE', undef, undef, undef),
tls_req_cert => hiera_undef('CONFIG_KEYSTONE_LDAP_TLS_REQ_CERT', undef), tls_req_cert => lookup('CONFIG_KEYSTONE_LDAP_TLS_REQ_CERT', undef, undef, undef),
identity_driver => 'keystone.identity.backends.ldap.Identity', identity_driver => 'keystone.identity.backends.ldap.Identity',
assignment_driver => $assignment_driver, assignment_driver => $assignment_driver,
} }