Format [keystone_authtoken] memcache_servers when IPv6 is used

When Memcached uses IPv6 network, the memcache_servers parameter should
be formatted as is described in the following example.
 inet6:[<host>]:<port>

This change ensures the proper format is applied even when hostnames
are used to define servers.

Also, this change fixes the timing to apply any2array. The function
should be applied before we check the first memcache server by [0],
otherwise the logic to detect IPv6 address does not work as intended.

Partial-Bug: #1964824
Depends-on: https://review.opendev.org/833708
Change-Id: I18537ab819996cfb0f2705d8c49666d4b9bfff22
This commit is contained in:
Takashi Kajinami 2022-03-15 11:04:48 +09:00
parent c985710e7a
commit 1e63b4c5f5
28 changed files with 409 additions and 115 deletions

View File

@ -31,6 +31,10 @@
# (Optional) Memcached port to use.
# Defaults to hiera('memcached_authtoken_port', 11211)
#
# [*memcached_ipv6*]
# (Optional) Whether Memcached uses IPv6 network instead of IPv4 network.
# Defauls to hiera('memcached_ipv6', false)
#
# [*security_strategy*]
# (Optional) Memcached (authtoken) security strategy.
# Defaults to hiera('memcached_authtoken_security_strategy', undef)
@ -50,18 +54,19 @@ class tripleo::profile::base::aodh::authtoken (
$step = Integer(hiera('step')),
$memcached_hosts = hiera('memcached_node_names', []),
$memcached_port = hiera('memcached_authtoken_port', 11211),
$memcached_ipv6 = hiera('memcached_ipv6', false),
$security_strategy = hiera('memcached_authtoken_security_strategy', undef),
$secret_key = hiera('memcached_authtoken_secret_key', undef),
# DEPRECATED PARAMETERS
$memcached_ips = undef
) {
$memcached_hosts_real = pick($memcached_ips, $memcached_hosts)
$memcached_hosts_real = any2array(pick($memcached_ips, $memcached_hosts))
if $step >= 3 {
if $memcached_hosts_real[0] =~ Stdlib::Compat::Ipv6 {
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_hosts_real)), ":${memcached_port}"), 'inet6:')
if $memcached_ipv6 or $memcached_hosts_real[0] =~ Stdlib::Compat::Ipv6 {
$memcache_servers = $memcached_hosts_real.map |$server| { "inet6:[${server}]:${memcached_port}" }
} else {
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_hosts_real)), ":${memcached_port}")
$memcache_servers = suffix($memcached_hosts_real, ":${memcached_port}")
}
if $secret_key {

View File

@ -31,6 +31,10 @@
# (Optional) Memcached port to use.
# Defaults to hiera('memcached_authtoken_port', 11211)
#
# [*memcached_ipv6*]
# (Optional) Whether Memcached uses IPv6 network instead of IPv4 network.
# Defauls to hiera('memcached_ipv6', false)
#
# [*security_strategy*]
# (Optional) Memcached (authtoken) security strategy.
# Defaults to hiera('memcached_authtoken_security_strategy', undef)
@ -50,18 +54,19 @@ class tripleo::profile::base::barbican::authtoken (
$step = Integer(hiera('step')),
$memcached_hosts = hiera('memcached_node_names', []),
$memcached_port = hiera('memcached_authtoken_port', 11211),
$memcached_ipv6 = hiera('memcached_ipv6', false),
$security_strategy = hiera('memcached_authtoken_security_strategy', undef),
$secret_key = hiera('memcached_authtoken_secret_key', undef),
# DEPRECATED PARAMETERS
$memcached_ips = undef
) {
$memcached_hosts_real = pick($memcached_ips, $memcached_hosts)
$memcached_hosts_real = any2array(pick($memcached_ips, $memcached_hosts))
if $step >= 3 {
if $memcached_hosts_real[0] =~ Stdlib::Compat::Ipv6 {
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_hosts_real)), ":${memcached_port}"), 'inet6:')
if $memcached_ipv6 or $memcached_hosts_real[0] =~ Stdlib::Compat::Ipv6 {
$memcache_servers = $memcached_hosts_real.map |$server| { "inet6:[${server}]:${memcached_port}" }
} else {
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_hosts_real)), ":${memcached_port}")
$memcache_servers = suffix($memcached_hosts_real, ":${memcached_port}")
}
if $secret_key {

View File

@ -31,6 +31,10 @@
# (Optional) Memcached port to use.
# Defaults to hiera('memcached_authtoken_port', 11211)
#
# [*memcached_ipv6*]
# (Optional) Whether Memcached uses IPv6 network instead of IPv4 network.
# Defauls to hiera('memcached_ipv6', false)
#
# [*security_strategy*]
# (Optional) Memcached (authtoken) security strategy.
# Defaults to hiera('memcached_authtoken_security_strategy', undef)
@ -50,18 +54,19 @@ class tripleo::profile::base::cinder::authtoken (
$step = Integer(hiera('step')),
$memcached_hosts = hiera('memcached_node_names', []),
$memcached_port = hiera('memcached_authtoken_port', 11211),
$memcached_ipv6 = hiera('memcached_ipv6', false),
$security_strategy = hiera('memcached_authtoken_security_strategy', undef),
$secret_key = hiera('memcached_authtoken_secret_key', undef),
# DEPRECATED PARAMETERS
$memcached_ips = undef
) {
$memcached_hosts_real = pick($memcached_ips, $memcached_hosts)
$memcached_hosts_real = any2array(pick($memcached_ips, $memcached_hosts))
if $step >= 3 {
if $memcached_hosts_real[0] =~ Stdlib::Compat::Ipv6 {
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_hosts_real)), ":${memcached_port}"), 'inet6:')
if $memcached_ipv6 or $memcached_hosts_real[0] =~ Stdlib::Compat::Ipv6 {
$memcache_servers = $memcached_hosts_real.map |$server| { "inet6:[${server}]:${memcached_port}" }
} else {
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_hosts_real)), ":${memcached_port}")
$memcache_servers = suffix($memcached_hosts_real, ":${memcached_port}")
}
if $secret_key {

View File

@ -31,6 +31,10 @@
# (Optional) Memcached port to use.
# Defaults to hiera('memcached_authtoken_port', 11211)
#
# [*memcached_ipv6*]
# (Optional) Whether Memcached uses IPv6 network instead of IPv4 network.
# Defauls to hiera('memcached_ipv6', false)
#
# [*security_strategy*]
# (Optional) Memcached (authtoken) security strategy.
# Defaults to hiera('memcached_authtoken_security_strategy', undef)
@ -50,18 +54,19 @@ class tripleo::profile::base::designate::authtoken (
$step = Integer(hiera('step')),
$memcached_hosts = hiera('memcached_node_names', []),
$memcached_port = hiera('memcached_authtoken_port', 11211),
$memcached_ipv6 = hiera('memcached_ipv6', false),
$security_strategy = hiera('memcached_authtoken_security_strategy', undef),
$secret_key = hiera('memcached_authtoken_secret_key', undef),
# DEPRECATED PARAMETERS
$memcached_ips = undef
) {
$memcached_hosts_real = pick($memcached_ips, $memcached_hosts)
$memcached_hosts_real = any2array(pick($memcached_ips, $memcached_hosts))
if $step >= 3 {
if $memcached_hosts_real[0] =~ Stdlib::Compat::Ipv6 {
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_hosts_real)), ":${memcached_port}"), 'inet6:')
if $memcached_ipv6 or $memcached_hosts_real[0] =~ Stdlib::Compat::Ipv6 {
$memcache_servers = $memcached_hosts_real.map |$server| { "inet6:[${server}]:${memcached_port}" }
} else {
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_hosts_real)), ":${memcached_port}")
$memcache_servers = suffix($memcached_hosts_real, ":${memcached_port}")
}
if $secret_key {

View File

@ -31,6 +31,10 @@
# (Optional) Memcached port to use.
# Defaults to hiera('memcached_authtoken_port', 11211)
#
# [*memcached_ipv6*]
# (Optional) Whether Memcached uses IPv6 network instead of IPv4 network.
# Defauls to hiera('memcached_ipv6', false)
#
# [*security_strategy*]
# (Optional) Memcached (authtoken) security strategy.
# Defaults to hiera('memcached_authtoken_security_strategy', undef)
@ -50,18 +54,19 @@ class tripleo::profile::base::glance::authtoken (
$step = Integer(hiera('step')),
$memcached_hosts = hiera('memcached_node_names', []),
$memcached_port = hiera('memcached_authtoken_port', 11211),
$memcached_ipv6 = hiera('memcached_ipv6', false),
$security_strategy = hiera('memcached_authtoken_security_strategy', undef),
$secret_key = hiera('memcached_authtoken_secret_key', undef),
# DEPRECATED PARAMETERS
$memcached_ips = undef
) {
$memcached_hosts_real = pick($memcached_ips, $memcached_hosts)
$memcached_hosts_real = any2array(pick($memcached_ips, $memcached_hosts))
if $step >= 3 {
if $memcached_hosts_real[0] =~ Stdlib::Compat::Ipv6 {
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_hosts_real)), ":${memcached_port}"), 'inet6:')
if $memcached_ipv6 or $memcached_hosts_real[0] =~ Stdlib::Compat::Ipv6 {
$memcache_servers = $memcached_hosts_real.map |$server| { "inet6:[${server}]:${memcached_port}" }
} else {
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_hosts_real)), ":${memcached_port}")
$memcache_servers = suffix($memcached_hosts_real, ":${memcached_port}")
}
if $secret_key {

View File

@ -31,6 +31,10 @@
# (Optional) Memcached port to use.
# Defaults to hiera('memcached_authtoken_port', 11211)
#
# [*memcached_ipv6*]
# (Optional) Whether Memcached uses IPv6 network instead of IPv4 network.
# Defauls to hiera('memcached_ipv6', false)
#
# [*security_strategy*]
# (Optional) Memcached (authtoken) security strategy.
# Defaults to hiera('memcached_authtoken_security_strategy', undef)
@ -50,18 +54,19 @@ class tripleo::profile::base::gnocchi::authtoken (
$step = Integer(hiera('step')),
$memcached_hosts = hiera('memcached_node_names', []),
$memcached_port = hiera('memcached_authtoken_port', 11211),
$memcached_ipv6 = hiera('memcached_ipv6', false),
$security_strategy = hiera('memcached_authtoken_security_strategy', undef),
$secret_key = hiera('memcached_authtoken_secret_key', undef),
# DEPRECATED PARAMETERS
$memcached_ips = undef
) {
$memcached_hosts_real = pick($memcached_ips, $memcached_hosts)
$memcached_hosts_real = any2array(pick($memcached_ips, $memcached_hosts))
if $step >= 3 {
if $memcached_hosts_real[0] =~ Stdlib::Compat::Ipv6 {
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_hosts_real)), ":${memcached_port}"), 'inet6:')
if $memcached_ipv6 or $memcached_hosts_real[0] =~ Stdlib::Compat::Ipv6 {
$memcache_servers = $memcached_hosts_real.map |$server| { "inet6:[${server}]:${memcached_port}" }
} else {
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_hosts_real)), ":${memcached_port}")
$memcache_servers = suffix($memcached_hosts_real, ":${memcached_port}")
}
if $secret_key {

View File

@ -31,6 +31,10 @@
# (Optional) Memcached port to use.
# Defaults to hiera('memcached_authtoken_port', 11211)
#
# [*memcached_ipv6*]
# (Optional) Whether Memcached uses IPv6 network instead of IPv4 network.
# Defauls to hiera('memcached_ipv6', false)
#
# [*security_strategy*]
# (Optional) Memcached (authtoken) security strategy.
# Defaults to hiera('memcached_authtoken_security_strategy', undef)
@ -50,18 +54,19 @@ class tripleo::profile::base::heat::authtoken (
$step = Integer(hiera('step')),
$memcached_hosts = hiera('memcached_node_names', []),
$memcached_port = hiera('memcached_authtoken_port', 11211),
$memcached_ipv6 = hiera('memcached_ipv6', false),
$security_strategy = hiera('memcached_authtoken_security_strategy', undef),
$secret_key = hiera('memcached_authtoken_secret_key', undef),
# DEPRECATED PARAMETERS
$memcached_ips = undef
) {
$memcached_hosts_real = pick($memcached_ips, $memcached_hosts)
$memcached_hosts_real = any2array(pick($memcached_ips, $memcached_hosts))
if $step >= 3 {
if $memcached_hosts_real[0] =~ Stdlib::Compat::Ipv6 {
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_hosts_real)), ":${memcached_port}"), 'inet6:')
if $memcached_ipv6 or $memcached_hosts_real[0] =~ Stdlib::Compat::Ipv6 {
$memcache_servers = $memcached_hosts_real.map |$server| { "inet6:[${server}]:${memcached_port}" }
} else {
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_hosts_real)), ":${memcached_port}")
$memcache_servers = suffix($memcached_hosts_real, ":${memcached_port}")
}
if $secret_key {

View File

@ -31,6 +31,10 @@
# (Optional) Memcached port to use.
# Defaults to hiera('memcached_authtoken_port', 11211)
#
# [*memcached_ipv6*]
# (Optional) Whether Memcached uses IPv6 network instead of IPv4 network.
# Defauls to hiera('memcached_ipv6', false)
#
# [*security_strategy*]
# (Optional) Memcached (authtoken) security strategy.
# Defaults to hiera('memcached_authtoken_security_strategy', undef)
@ -50,18 +54,19 @@ class tripleo::profile::base::ironic::authtoken (
$step = Integer(hiera('step')),
$memcached_hosts = hiera('memcached_node_names', []),
$memcached_port = hiera('memcached_authtoken_port', 11211),
$memcached_ipv6 = hiera('memcached_ipv6', false),
$security_strategy = hiera('memcached_authtoken_security_strategy', undef),
$secret_key = hiera('memcached_authtoken_secret_key', undef),
# DEPRECATED PARAMETERS
$memcached_ips = undef
) {
$memcached_hosts_real = pick($memcached_ips, $memcached_hosts)
$memcached_hosts_real = any2array(pick($memcached_ips, $memcached_hosts))
if $step >= 3 {
if $memcached_hosts_real[0] =~ Stdlib::Compat::Ipv6 {
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_hosts_real)), ":${memcached_port}"), 'inet6:')
if $memcached_ipv6 or $memcached_hosts_real[0] =~ Stdlib::Compat::Ipv6 {
$memcache_servers = $memcached_hosts_real.map |$server| { "inet6:[${server}]:${memcached_port}" }
} else {
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_hosts_real)), ":${memcached_port}")
$memcache_servers = suffix($memcached_hosts_real, ":${memcached_port}")
}
if $secret_key {

View File

@ -31,6 +31,10 @@
# (Optional) Memcached port to use.
# Defaults to hiera('memcached_authtoken_port', 11211)
#
# [*memcached_ipv6*]
# (Optional) Whether Memcached uses IPv6 network instead of IPv4 network.
# Defauls to hiera('memcached_ipv6', false)
#
# [*security_strategy*]
# (Optional) Memcached (authtoken) security strategy.
# Defaults to hiera('memcached_authtoken_security_strategy', undef)
@ -50,18 +54,19 @@ class tripleo::profile::base::ironic_inspector::authtoken (
$step = Integer(hiera('step')),
$memcached_hosts = hiera('memcached_node_names', []),
$memcached_port = hiera('memcached_authtoken_port', 11211),
$memcached_ipv6 = hiera('memcached_ipv6', false),
$security_strategy = hiera('memcached_authtoken_security_strategy', undef),
$secret_key = hiera('memcached_authtoken_secret_key', undef),
# DEPRECATED PARAMETERS
$memcached_ips = undef
) {
$memcached_hosts_real = pick($memcached_ips, $memcached_hosts)
$memcached_hosts_real = any2array(pick($memcached_ips, $memcached_hosts))
if $step >= 3 {
if $memcached_hosts_real[0] =~ Stdlib::Compat::Ipv6 {
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_hosts_real)), ":${memcached_port}"), 'inet6:')
if $memcached_ipv6 or $memcached_hosts_real[0] =~ Stdlib::Compat::Ipv6 {
$memcache_servers = $memcached_hosts_real.map |$server| { "inet6:[${server}]:${memcached_port}" }
} else {
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_hosts_real)), ":${memcached_port}")
$memcache_servers = suffix($memcached_hosts_real, ":${memcached_port}")
}
if $secret_key {

View File

@ -31,6 +31,10 @@
# (Optional) Memcached port to use.
# Defaults to hiera('memcached_authtoken_port', 11211)
#
# [*memcached_ipv6*]
# (Optional) Whether Memcached uses IPv6 network instead of IPv4 network.
# Defauls to hiera('memcached_ipv6', false)
#
# [*security_strategy*]
# (Optional) Memcached (authtoken) security strategy.
# Defaults to hiera('memcached_authtoken_security_strategy', undef)
@ -50,18 +54,19 @@ class tripleo::profile::base::manila::authtoken (
$step = Integer(hiera('step')),
$memcached_hosts = hiera('memcached_node_names', []),
$memcached_port = hiera('memcached_authtoken_port', 11211),
$memcached_ipv6 = hiera('memcached_ipv6', false),
$security_strategy = hiera('memcached_authtoken_security_strategy', undef),
$secret_key = hiera('memcached_authtoken_secret_key', undef),
# DEPRECATED PARAMETERS
$memcached_ips = undef
) {
$memcached_hosts_real = pick($memcached_ips, $memcached_hosts)
$memcached_hosts_real = any2array(pick($memcached_ips, $memcached_hosts))
if $step >= 3 {
if $memcached_hosts_real[0] =~ Stdlib::Compat::Ipv6 {
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_hosts_real)), ":${memcached_port}"), 'inet6:')
if $memcached_ipv6 or $memcached_hosts_real[0] =~ Stdlib::Compat::Ipv6 {
$memcache_servers = $memcached_hosts_real.map |$server| { "inet6:[${server}]:${memcached_port}" }
} else {
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_hosts_real)), ":${memcached_port}")
$memcache_servers = suffix($memcached_hosts_real, ":${memcached_port}")
}
if $secret_key {

View File

@ -31,6 +31,10 @@
# (Optional) Memcached port to use.
# Defaults to hiera('memcached_authtoken_port', 11211)
#
# [*memcached_ipv6*]
# (Optional) Whether Memcached uses IPv6 network instead of IPv4 network.
# Defauls to hiera('memcached_ipv6', false)
#
# [*security_strategy*]
# (Optional) Memcached (authtoken) security strategy.
# Defaults to hiera('memcached_authtoken_security_strategy', undef)
@ -50,18 +54,19 @@ class tripleo::profile::base::neutron::authtoken (
$step = Integer(hiera('step')),
$memcached_hosts = hiera('memcached_node_names', []),
$memcached_port = hiera('memcached_authtoken_port', 11211),
$memcached_ipv6 = hiera('memcached_ipv6', false),
$security_strategy = hiera('memcached_authtoken_security_strategy', undef),
$secret_key = hiera('memcached_authtoken_secret_key', undef),
# DEPRECATED PARAMETERS
$memcached_ips = undef
) {
$memcached_hosts_real = pick($memcached_ips, $memcached_hosts)
$memcached_hosts_real = any2array(pick($memcached_ips, $memcached_hosts))
if $step >= 3 {
if $memcached_hosts_real[0] =~ Stdlib::Compat::Ipv6 {
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_hosts_real)), ":${memcached_port}"), 'inet6:')
if $memcached_ipv6 or $memcached_hosts_real[0] =~ Stdlib::Compat::Ipv6 {
$memcache_servers = $memcached_hosts_real.map |$server| { "inet6:[${server}]:${memcached_port}" }
} else {
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_hosts_real)), ":${memcached_port}")
$memcache_servers = suffix($memcached_hosts_real, ":${memcached_port}")
}
if $secret_key {

View File

@ -31,6 +31,10 @@
# (Optional) Memcached port to use.
# Defaults to hiera('memcached_authtoken_port', 11211)
#
# [*memcached_ipv6*]
# (Optional) Whether Memcached uses IPv6 network instead of IPv4 network.
# Defauls to hiera('memcached_ipv6', false)
#
# [*security_strategy*]
# (Optional) Memcached (authtoken) security strategy.
# Defaults to hiera('memcached_authtoken_security_strategy', undef)
@ -50,18 +54,19 @@ class tripleo::profile::base::nova::authtoken (
$step = Integer(hiera('step')),
$memcached_hosts = hiera('memcached_node_names', []),
$memcached_port = hiera('memcached_authtoken_port', 11211),
$memcached_ipv6 = hiera('memcached_ipv6', false),
$security_strategy = hiera('memcached_authtoken_security_strategy', undef),
$secret_key = hiera('memcached_authtoken_secret_key', undef),
# DEPRECATED PARAMETERS
$memcached_ips = undef
) {
$memcached_hosts_real = pick($memcached_ips, $memcached_hosts)
$memcached_hosts_real = any2array(pick($memcached_ips, $memcached_hosts))
if $step >= 3 {
if $memcached_hosts_real[0] =~ Stdlib::Compat::Ipv6 {
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_hosts_real)), ":${memcached_port}"), 'inet6:')
if $memcached_ipv6 or $memcached_hosts_real[0] =~ Stdlib::Compat::Ipv6 {
$memcache_servers = $memcached_hosts_real.map |$server| { "inet6:[${server}]:${memcached_port}" }
} else {
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_hosts_real)), ":${memcached_port}")
$memcache_servers = suffix($memcached_hosts_real, ":${memcached_port}")
}
if $secret_key {

View File

@ -31,6 +31,10 @@
# (Optional) Memcached port to use.
# Defaults to hiera('memcached_authtoken_port', 11211)
#
# [*memcached_ipv6*]
# (Optional) Whether Memcached uses IPv6 network instead of IPv4 network.
# Defauls to hiera('memcached_ipv6', false)
#
# [*security_strategy*]
# (Optional) Memcached (authtoken) security strategy.
# Defaults to hiera('memcached_authtoken_security_strategy', undef)
@ -50,18 +54,19 @@ class tripleo::profile::base::octavia::authtoken (
$step = Integer(hiera('step')),
$memcached_hosts = hiera('memcached_node_names', []),
$memcached_port = hiera('memcached_authtoken_port', 11211),
$memcached_ipv6 = hiera('memcached_ipv6', false),
$security_strategy = hiera('memcached_authtoken_security_strategy', undef),
$secret_key = hiera('memcached_authtoken_secret_key', undef),
# DEPRECATED PARAMETERS
$memcached_ips = undef
) {
$memcached_hosts_real = pick($memcached_ips, $memcached_hosts)
$memcached_hosts_real = any2array(pick($memcached_ips, $memcached_hosts))
if $step >= 3 {
if $memcached_hosts_real[0] =~ Stdlib::Compat::Ipv6 {
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_hosts_real)), ":${memcached_port}"), 'inet6:')
if $memcached_ipv6 or $memcached_hosts_real[0] =~ Stdlib::Compat::Ipv6 {
$memcache_servers = $memcached_hosts_real.map |$server| { "inet6:[${server}]:${memcached_port}" }
} else {
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_hosts_real)), ":${memcached_port}")
$memcache_servers = suffix($memcached_hosts_real, ":${memcached_port}")
}
if $secret_key {

View File

@ -31,6 +31,10 @@
# (Optional) Memcached port to use.
# Defaults to hiera('memcached_authtoken_port', 11211)
#
# [*memcached_ipv6*]
# (Optional) Whether Memcached uses IPv6 network instead of IPv4 network.
# Defauls to hiera('memcached_ipv6', false)
#
# [*security_strategy*]
# (Optional) Memcached (authtoken) security strategy.
# Defaults to hiera('memcached_authtoken_security_strategy', undef)
@ -50,18 +54,19 @@ class tripleo::profile::base::placement::authtoken (
$step = Integer(hiera('step')),
$memcached_hosts = hiera('memcached_node_names', []),
$memcached_port = hiera('memcached_authtoken_port', 11211),
$memcached_ipv6 = hiera('memcached_ipv6', false),
$security_strategy = hiera('memcached_authtoken_security_strategy', undef),
$secret_key = hiera('memcached_authtoken_secret_key', undef),
# DEPRECATED PARAMETERS
$memcached_ips = undef
) {
$memcached_hosts_real = pick($memcached_ips, $memcached_hosts)
$memcached_hosts_real = any2array(pick($memcached_ips, $memcached_hosts))
if $step >= 3 {
if $memcached_hosts_real[0] =~ Stdlib::Compat::Ipv6 {
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_hosts_real)), ":${memcached_port}"), 'inet6:')
if $memcached_ipv6 or $memcached_hosts_real[0] =~ Stdlib::Compat::Ipv6 {
$memcache_servers = $memcached_hosts_real.map |$server| { "inet6:[${server}]:${memcached_port}" }
} else {
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_hosts_real)), ":${memcached_port}")
$memcache_servers = suffix($memcached_hosts_real, ":${memcached_port}")
}
if $secret_key {

View File

@ -31,30 +31,46 @@ describe 'tripleo::profile::base::aodh::authtoken' do
context 'with step 3' do
let(:params) { {
:step => 3,
:step => 3,
:memcached_hosts => '127.0.0.1',
} }
it {
is_expected.to contain_class('tripleo::profile::base::aodh::authtoken')
is_expected.to contain_class('aodh::keystone::authtoken').with(
:memcached_servers => ['127.0.0.1:11211'])
:memcached_servers => ['127.0.0.1:11211']
)
}
end
context 'with step 3 with ipv6' do
let(:params) { {
:step => 3,
:step => 3,
:memcached_hosts => '::1',
} }
it {
is_expected.to contain_class('tripleo::profile::base::aodh::authtoken')
is_expected.to contain_class('aodh::keystone::authtoken').with(
:memcached_servers => ['[::1]:11211'])
:memcached_servers => ['inet6:[::1]:11211']
)
}
end
context 'with step 3 with the ipv6 parameter' do
let(:params) { {
:step => 3,
:memcached_hosts => 'node.example.com',
:memcached_ipv6 => true,
} }
it {
is_expected.to contain_class('tripleo::profile::base::aodh::authtoken')
is_expected.to contain_class('aodh::keystone::authtoken').with(
:memcached_servers => ['inet6:[node.example.com]:11211']
)
}
end
end

View File

@ -31,30 +31,46 @@ describe 'tripleo::profile::base::barbican::authtoken' do
context 'with step 3' do
let(:params) { {
:step => 3,
:step => 3,
:memcached_hosts => '127.0.0.1',
} }
it {
is_expected.to contain_class('tripleo::profile::base::barbican::authtoken')
is_expected.to contain_class('barbican::keystone::authtoken').with(
:memcached_servers => ['127.0.0.1:11211'])
:memcached_servers => ['127.0.0.1:11211']
)
}
end
context 'with step 3 with ipv6' do
let(:params) { {
:step => 3,
:step => 3,
:memcached_hosts => '::1',
} }
it {
is_expected.to contain_class('tripleo::profile::base::barbican::authtoken')
is_expected.to contain_class('barbican::keystone::authtoken').with(
:memcached_servers => ['[::1]:11211'])
:memcached_servers => ['inet6:[::1]:11211']
)
}
end
context 'with step 3 with the ipv6 parameter' do
let(:params) { {
:step => 3,
:memcached_hosts => 'node.example.com',
:memcached_ipv6 => true,
} }
it {
is_expected.to contain_class('tripleo::profile::base::barbican::authtoken')
is_expected.to contain_class('barbican::keystone::authtoken').with(
:memcached_servers => ['inet6:[node.example.com]:11211']
)
}
end
end

View File

@ -31,30 +31,46 @@ describe 'tripleo::profile::base::cinder::authtoken' do
context 'with step 3' do
let(:params) { {
:step => 3,
:step => 3,
:memcached_hosts => '127.0.0.1',
} }
it {
is_expected.to contain_class('tripleo::profile::base::cinder::authtoken')
is_expected.to contain_class('cinder::keystone::authtoken').with(
:memcached_servers => ['127.0.0.1:11211'])
:memcached_servers => ['127.0.0.1:11211']
)
}
end
context 'with step 3 with ipv6' do
let(:params) { {
:step => 3,
:step => 3,
:memcached_hosts => '::1',
} }
it {
is_expected.to contain_class('tripleo::profile::base::cinder::authtoken')
is_expected.to contain_class('cinder::keystone::authtoken').with(
:memcached_servers => ['[::1]:11211'])
:memcached_servers => ['inet6:[::1]:11211']
)
}
end
context 'with step 3 with the ipv6 parameter' do
let(:params) { {
:step => 3,
:memcached_hosts => 'node.example.com',
:memcached_ipv6 => true,
} }
it {
is_expected.to contain_class('tripleo::profile::base::cinder::authtoken')
is_expected.to contain_class('cinder::keystone::authtoken').with(
:memcached_servers => ['inet6:[node.example.com]:11211']
)
}
end
end

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2020 Red Hat, Inc.
# Copyright (C) 2019 Red Hat, Inc.
#
# 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
@ -31,30 +31,46 @@ describe 'tripleo::profile::base::designate::authtoken' do
context 'with step 3' do
let(:params) { {
:step => 3,
:step => 3,
:memcached_hosts => '127.0.0.1',
} }
it {
is_expected.to contain_class('tripleo::profile::base::designate::authtoken')
is_expected.to contain_class('designate::keystone::authtoken').with(
:memcached_servers => ['127.0.0.1:11211'])
:memcached_servers => ['127.0.0.1:11211']
)
}
end
context 'with step 3 with ipv6' do
let(:params) { {
:step => 3,
:step => 3,
:memcached_hosts => '::1',
} }
it {
is_expected.to contain_class('tripleo::profile::base::designate::authtoken')
is_expected.to contain_class('designate::keystone::authtoken').with(
:memcached_servers => ['[::1]:11211'])
:memcached_servers => ['inet6:[::1]:11211']
)
}
end
context 'with step 3 with the ipv6 parameter' do
let(:params) { {
:step => 3,
:memcached_hosts => 'node.example.com',
:memcached_ipv6 => true,
} }
it {
is_expected.to contain_class('tripleo::profile::base::designate::authtoken')
is_expected.to contain_class('designate::keystone::authtoken').with(
:memcached_servers => ['inet6:[node.example.com]:11211']
)
}
end
end

View File

@ -31,30 +31,46 @@ describe 'tripleo::profile::base::glance::authtoken' do
context 'with step 3' do
let(:params) { {
:step => 3,
:step => 3,
:memcached_hosts => '127.0.0.1',
} }
it {
is_expected.to contain_class('tripleo::profile::base::glance::authtoken')
is_expected.to contain_class('glance::api::authtoken').with(
:memcached_servers => ['127.0.0.1:11211'])
:memcached_servers => ['127.0.0.1:11211']
)
}
end
context 'with step 3 with ipv6' do
let(:params) { {
:step => 3,
:step => 3,
:memcached_hosts => '::1',
} }
it {
is_expected.to contain_class('tripleo::profile::base::glance::authtoken')
is_expected.to contain_class('glance::api::authtoken').with(
:memcached_servers => ['[::1]:11211'])
:memcached_servers => ['inet6:[::1]:11211']
)
}
end
context 'with step 3 with the ipv6 parameter' do
let(:params) { {
:step => 3,
:memcached_hosts => 'node.example.com',
:memcached_ipv6 => true,
} }
it {
is_expected.to contain_class('tripleo::profile::base::glance::authtoken')
is_expected.to contain_class('glance::api::authtoken').with(
:memcached_servers => ['inet6:[node.example.com]:11211']
)
}
end
end

View File

@ -31,30 +31,46 @@ describe 'tripleo::profile::base::gnocchi::authtoken' do
context 'with step 3' do
let(:params) { {
:step => 3,
:step => 3,
:memcached_hosts => '127.0.0.1',
} }
it {
is_expected.to contain_class('tripleo::profile::base::gnocchi::authtoken')
is_expected.to contain_class('gnocchi::keystone::authtoken').with(
:memcached_servers => ['127.0.0.1:11211'])
:memcached_servers => ['127.0.0.1:11211']
)
}
end
context 'with step 3 with ipv6' do
let(:params) { {
:step => 3,
:step => 3,
:memcached_hosts => '::1',
} }
it {
is_expected.to contain_class('tripleo::profile::base::gnocchi::authtoken')
is_expected.to contain_class('gnocchi::keystone::authtoken').with(
:memcached_servers => ['[::1]:11211'])
:memcached_servers => ['inet6:[::1]:11211']
)
}
end
context 'with step 3 with the ipv6 parameter' do
let(:params) { {
:step => 3,
:memcached_hosts => 'node.example.com',
:memcached_ipv6 => true,
} }
it {
is_expected.to contain_class('tripleo::profile::base::gnocchi::authtoken')
is_expected.to contain_class('gnocchi::keystone::authtoken').with(
:memcached_servers => ['inet6:[node.example.com]:11211']
)
}
end
end

View File

@ -31,30 +31,46 @@ describe 'tripleo::profile::base::heat::authtoken' do
context 'with step 3' do
let(:params) { {
:step => 3,
:step => 3,
:memcached_hosts => '127.0.0.1',
} }
it {
is_expected.to contain_class('tripleo::profile::base::heat::authtoken')
is_expected.to contain_class('heat::keystone::authtoken').with(
:memcached_servers => ['127.0.0.1:11211'])
:memcached_servers => ['127.0.0.1:11211']
)
}
end
context 'with step 3 with ipv6' do
let(:params) { {
:step => 3,
:step => 3,
:memcached_hosts => '::1',
} }
it {
is_expected.to contain_class('tripleo::profile::base::heat::authtoken')
is_expected.to contain_class('heat::keystone::authtoken').with(
:memcached_servers => ['[::1]:11211'])
:memcached_servers => ['inet6:[::1]:11211']
)
}
end
context 'with step 3 with the ipv6 parameter' do
let(:params) { {
:step => 3,
:memcached_hosts => 'node.example.com',
:memcached_ipv6 => true,
} }
it {
is_expected.to contain_class('tripleo::profile::base::heat::authtoken')
is_expected.to contain_class('heat::keystone::authtoken').with(
:memcached_servers => ['inet6:[node.example.com]:11211']
)
}
end
end

View File

@ -31,30 +31,46 @@ describe 'tripleo::profile::base::ironic::authtoken' do
context 'with step 3' do
let(:params) { {
:step => 3,
:step => 3,
:memcached_hosts => '127.0.0.1',
} }
it {
is_expected.to contain_class('tripleo::profile::base::ironic::authtoken')
is_expected.to contain_class('ironic::api::authtoken').with(
:memcached_servers => ['127.0.0.1:11211'])
:memcached_servers => ['127.0.0.1:11211']
)
}
end
context 'with step 3 with ipv6' do
let(:params) { {
:step => 3,
:step => 3,
:memcached_hosts => '::1',
} }
it {
is_expected.to contain_class('tripleo::profile::base::ironic::authtoken')
is_expected.to contain_class('ironic::api::authtoken').with(
:memcached_servers => ['[::1]:11211'])
:memcached_servers => ['inet6:[::1]:11211']
)
}
end
context 'with step 3 with the ipv6 parameter' do
let(:params) { {
:step => 3,
:memcached_hosts => 'node.example.com',
:memcached_ipv6 => true,
} }
it {
is_expected.to contain_class('tripleo::profile::base::ironic::authtoken')
is_expected.to contain_class('ironic::api::authtoken').with(
:memcached_servers => ['inet6:[node.example.com]:11211']
)
}
end
end

View File

@ -31,30 +31,46 @@ describe 'tripleo::profile::base::ironic_inspector::authtoken' do
context 'with step 3' do
let(:params) { {
:step => 3,
:step => 3,
:memcached_hosts => '127.0.0.1',
} }
it {
is_expected.to contain_class('tripleo::profile::base::ironic_inspector::authtoken')
is_expected.to contain_class('ironic::inspector::authtoken').with(
:memcached_servers => ['127.0.0.1:11211'])
:memcached_servers => ['127.0.0.1:11211']
)
}
end
context 'with step 3 with ipv6' do
let(:params) { {
:step => 3,
:step => 3,
:memcached_hosts => '::1',
} }
it {
is_expected.to contain_class('tripleo::profile::base::ironic_inspector::authtoken')
is_expected.to contain_class('ironic::inspector::authtoken').with(
:memcached_servers => ['[::1]:11211'])
:memcached_servers => ['inet6:[::1]:11211']
)
}
end
context 'with step 3 with the ipv6 parameter' do
let(:params) { {
:step => 3,
:memcached_hosts => 'node.example.com',
:memcached_ipv6 => true,
} }
it {
is_expected.to contain_class('tripleo::profile::base::ironic_inspector::authtoken')
is_expected.to contain_class('ironic::inspector::authtoken').with(
:memcached_servers => ['inet6:[node.example.com]:11211']
)
}
end
end

View File

@ -31,30 +31,46 @@ describe 'tripleo::profile::base::manila::authtoken' do
context 'with step 3' do
let(:params) { {
:step => 3,
:step => 3,
:memcached_hosts => '127.0.0.1',
} }
it {
is_expected.to contain_class('tripleo::profile::base::manila::authtoken')
is_expected.to contain_class('manila::keystone::authtoken').with(
:memcached_servers => ['127.0.0.1:11211'])
:memcached_servers => ['127.0.0.1:11211']
)
}
end
context 'with step 3 with ipv6' do
let(:params) { {
:step => 3,
:step => 3,
:memcached_hosts => '::1',
} }
it {
is_expected.to contain_class('tripleo::profile::base::manila::authtoken')
is_expected.to contain_class('manila::keystone::authtoken').with(
:memcached_servers => ['[::1]:11211'])
:memcached_servers => ['inet6:[::1]:11211']
)
}
end
context 'with step 3 with the ipv6 parameter' do
let(:params) { {
:step => 3,
:memcached_hosts => 'node.example.com',
:memcached_ipv6 => true,
} }
it {
is_expected.to contain_class('tripleo::profile::base::manila::authtoken')
is_expected.to contain_class('manila::keystone::authtoken').with(
:memcached_servers => ['inet6:[node.example.com]:11211']
)
}
end
end

View File

@ -31,30 +31,46 @@ describe 'tripleo::profile::base::neutron::authtoken' do
context 'with step 3' do
let(:params) { {
:step => 3,
:step => 3,
:memcached_hosts => '127.0.0.1',
} }
it {
is_expected.to contain_class('tripleo::profile::base::neutron::authtoken')
is_expected.to contain_class('neutron::keystone::authtoken').with(
:memcached_servers => ['127.0.0.1:11211'])
:memcached_servers => ['127.0.0.1:11211']
)
}
end
context 'with step 3 with ipv6' do
let(:params) { {
:step => 3,
:step => 3,
:memcached_hosts => '::1',
} }
it {
is_expected.to contain_class('tripleo::profile::base::neutron::authtoken')
is_expected.to contain_class('neutron::keystone::authtoken').with(
:memcached_servers => ['[::1]:11211'])
:memcached_servers => ['inet6:[::1]:11211']
)
}
end
context 'with step 3 with the ipv6 parameter' do
let(:params) { {
:step => 3,
:memcached_hosts => 'node.example.com',
:memcached_ipv6 => true,
} }
it {
is_expected.to contain_class('tripleo::profile::base::neutron::authtoken')
is_expected.to contain_class('neutron::keystone::authtoken').with(
:memcached_servers => ['inet6:[node.example.com]:11211']
)
}
end
end

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2017 Red Hat, Inc.
# Copyright (C) 2019 Red Hat, Inc.
#
# 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
@ -31,30 +31,46 @@ describe 'tripleo::profile::base::nova::authtoken' do
context 'with step 3' do
let(:params) { {
:step => 3,
:step => 3,
:memcached_hosts => '127.0.0.1',
} }
it {
is_expected.to contain_class('tripleo::profile::base::nova::authtoken')
is_expected.to contain_class('nova::keystone::authtoken').with(
:memcached_servers => ['127.0.0.1:11211'])
:memcached_servers => ['127.0.0.1:11211']
)
}
end
context 'with step 3 with ipv6' do
let(:params) { {
:step => 3,
:step => 3,
:memcached_hosts => '::1',
} }
it {
is_expected.to contain_class('tripleo::profile::base::nova::authtoken')
is_expected.to contain_class('nova::keystone::authtoken').with(
:memcached_servers => ['[::1]:11211'])
:memcached_servers => ['inet6:[::1]:11211']
)
}
end
context 'with step 3 with the ipv6 parameter' do
let(:params) { {
:step => 3,
:memcached_hosts => 'node.example.com',
:memcached_ipv6 => true,
} }
it {
is_expected.to contain_class('tripleo::profile::base::nova::authtoken')
is_expected.to contain_class('nova::keystone::authtoken').with(
:memcached_servers => ['inet6:[node.example.com]:11211']
)
}
end
end

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2017 Red Hat, Inc.
# Copyright (C) 2019 Red Hat, Inc.
#
# 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
@ -31,30 +31,46 @@ describe 'tripleo::profile::base::octavia::authtoken' do
context 'with step 3' do
let(:params) { {
:step => 3,
:step => 3,
:memcached_hosts => '127.0.0.1',
} }
it {
is_expected.to contain_class('tripleo::profile::base::octavia::authtoken')
is_expected.to contain_class('octavia::keystone::authtoken').with(
:memcached_servers => ['127.0.0.1:11211'])
:memcached_servers => ['127.0.0.1:11211']
)
}
end
context 'with step 3 with ipv6' do
let(:params) { {
:step => 3,
:step => 3,
:memcached_hosts => '::1',
} }
it {
is_expected.to contain_class('tripleo::profile::base::octavia::authtoken')
is_expected.to contain_class('octavia::keystone::authtoken').with(
:memcached_servers => ['[::1]:11211'])
:memcached_servers => ['inet6:[::1]:11211']
)
}
end
context 'with step 3 with the ipv6 parameter' do
let(:params) { {
:step => 3,
:memcached_hosts => 'node.example.com',
:memcached_ipv6 => true,
} }
it {
is_expected.to contain_class('tripleo::profile::base::octavia::authtoken')
is_expected.to contain_class('octavia::keystone::authtoken').with(
:memcached_servers => ['inet6:[node.example.com]:11211']
)
}
end
end

View File

@ -31,30 +31,46 @@ describe 'tripleo::profile::base::placement::authtoken' do
context 'with step 3' do
let(:params) { {
:step => 3,
:step => 3,
:memcached_hosts => '127.0.0.1',
} }
it {
is_expected.to contain_class('tripleo::profile::base::placement::authtoken')
is_expected.to contain_class('placement::keystone::authtoken').with(
:memcached_servers => ['127.0.0.1:11211'])
:memcached_servers => ['127.0.0.1:11211']
)
}
end
context 'with step 3 with ipv6' do
let(:params) { {
:step => 3,
:step => 3,
:memcached_hosts => '::1',
} }
it {
is_expected.to contain_class('tripleo::profile::base::placement::authtoken')
is_expected.to contain_class('placement::keystone::authtoken').with(
:memcached_servers => ['[::1]:11211'])
:memcached_servers => ['inet6:[::1]:11211']
)
}
end
context 'with step 3 with the ipv6 parameter' do
let(:params) { {
:step => 3,
:memcached_hosts => 'node.example.com',
:memcached_ipv6 => true,
} }
it {
is_expected.to contain_class('tripleo::profile::base::placement::authtoken')
is_expected.to contain_class('placement::keystone::authtoken').with(
:memcached_servers => ['inet6:[node.example.com]:11211']
)
}
end
end