pacemaker: add support for Hash vs List in container environment

We are transitioning from an array to an hash for the container
environment of each container:
I894f339cdf03bc2a93c588f826f738b0b851a3ad

Mainly to make it consummable by Ansible later; where the
podman_container module needs a dict instead of a list.

This patch just changes the default, and also adds support for an Hash
instead of a List, but still supporting the List.

Change-Id: I4e53a4a3464940660473bcbe74e30507a69a4019
This commit is contained in:
Emilien Macchi 2019-10-11 17:57:34 -04:00
parent 06e901c215
commit f8d9dfb497
3 changed files with 29 additions and 15 deletions

View File

@ -27,8 +27,8 @@
# Defaults to []
#
# [*docker_environment*]
# (Optional) The list of environment variables set in the docker container
# Defaults to ['KOLLA_CONFIG_STRATEGY=COPY_ALWAYS']
# (Optional) List or Hash of environment variables set in the docker container
# Defaults to {'KOLLA_CONFIG_STRATEGY' => 'COPY_ALWAYS'}
#
# [*pcs_tries*]
# (Optional) The number of times pcs commands should be retried.
@ -55,7 +55,7 @@ class tripleo::profile::pacemaker::cinder::backup_bundle (
$bootstrap_node = hiera('cinder_backup_short_bootstrap_node_name'),
$cinder_backup_docker_image = hiera('tripleo::profile::pacemaker::cinder::backup_bundle::cinder_backup_docker_image', undef),
$docker_volumes = [],
$docker_environment = ['KOLLA_CONFIG_STRATEGY=COPY_ALWAYS'],
$docker_environment = {'KOLLA_CONFIG_STRATEGY' => 'COPY_ALWAYS'},
$container_backend = 'docker',
$tls_priorities = hiera('tripleo::pacemaker::tls_priorities', undef),
$pcs_tries = hiera('pcs_tries', 20),
@ -182,8 +182,13 @@ class tripleo::profile::pacemaker::cinder::backup_bundle (
}
}
$docker_env_arr = delete(any2array($docker_environment), '').flatten()
$docker_env = join($docker_env_arr.map |$var| { "-e ${var}" }, ' ')
if is_hash($docker_environment) {
$docker_env = join($docker_environment.map |$index, $value| { "-e ${index}=${value}" }, ' ')
} else {
$docker_env_arr = delete(any2array($docker_environment), '').flatten()
$docker_env = join($docker_env_arr.map |$var| { "-e ${var}" }, ' ')
}
if $tls_priorities != undef {
$tls_priorities_real = " -e PCMK_tls_priorities=${tls_priorities}"
} else {

View File

@ -27,8 +27,8 @@
# Defaults to []
#
# [*docker_environment*]
# (Optional) The list of environment variables set in the docker container
# Defaults to ['KOLLA_CONFIG_STRATEGY=COPY_ALWAYS']
# (Optional) List or Hash of environment variables set in the docker container
# Defaults to {'KOLLA_CONFIG_STRATEGY' => 'COPY_ALWAYS'}
#
# [*pcs_tries*]
# (Optional) The number of times pcs commands should be retried.
@ -55,7 +55,7 @@ class tripleo::profile::pacemaker::cinder::volume_bundle (
$bootstrap_node = hiera('cinder_volume_short_bootstrap_node_name'),
$cinder_volume_docker_image = hiera('tripleo::profile::pacemaker::cinder::volume_bundle::cinder_volume_docker_image', undef),
$docker_volumes = [],
$docker_environment = ['KOLLA_CONFIG_STRATEGY=COPY_ALWAYS'],
$docker_environment = {'KOLLA_CONFIG_STRATEGY' => 'COPY_ALWAYS'},
$pcs_tries = hiera('pcs_tries', 20),
$step = Integer(hiera('step')),
$container_backend = 'docker',
@ -183,8 +183,13 @@ class tripleo::profile::pacemaker::cinder::volume_bundle (
}
}
$docker_env_arr = delete(any2array($docker_environment), '').flatten()
$docker_env = join($docker_env_arr.map |$var| { "-e ${var}" }, ' ')
if is_hash($docker_environment) {
$docker_env = join($docker_environment.map |$index, $value| { "-e ${index}=${value}" }, ' ')
} else {
$docker_env_arr = delete(any2array($docker_environment), '').flatten()
$docker_env = join($docker_env_arr.map |$var| { "-e ${var}" }, ' ')
}
if $tls_priorities != undef {
$tls_priorities_real = " -e PCMK_tls_priorities=${tls_priorities}"
} else {

View File

@ -31,8 +31,8 @@
# Defaults to []
#
# [*docker_environment*]
# (Optional) The list of environment variables set in the docker container
# Defaults to ['KOLLA_CONFIG_STRATEGY=COPY_ALWAYS']
# (Optional) List or Hash of environment variables set in the docker container
# Defaults to {'KOLLA_CONFIG_STRATEGY' => 'COPY_ALWAYS'}
#
# [*pcs_tries*]
# (Optional) The number of times pcs commands should be retried.
@ -59,7 +59,7 @@ class tripleo::profile::pacemaker::manila::share_bundle (
$bootstrap_node = hiera('manila_share_short_bootstrap_node_name'),
$manila_share_docker_image = hiera('tripleo::profile::pacemaker::manila::share_bundle::manila_share_docker_image', undef),
$docker_volumes = [],
$docker_environment = ['KOLLA_CONFIG_STRATEGY=COPY_ALWAYS'],
$docker_environment = {'KOLLA_CONFIG_STRATEGY' => 'COPY_ALWAYS'},
$ceph_nfs_enabled = hiera('ceph_nfs_enabled', false),
$container_backend = 'docker',
$tls_priorities = hiera('tripleo::pacemaker::tls_priorities', undef),
@ -201,8 +201,12 @@ class tripleo::profile::pacemaker::manila::share_bundle (
$storage_maps = merge($default_storage_maps, $extra_storage_maps)
}
$docker_env_arr = delete(any2array($docker_environment), '').flatten()
$docker_env = join($docker_env_arr.map |$var| { "-e ${var}" }, ' ')
if is_hash($docker_environment) {
$docker_env = join($docker_environment.map |$index, $value| { "-e ${index}=${value}" }, ' ')
} else {
$docker_env_arr = delete(any2array($docker_environment), '').flatten()
$docker_env = join($docker_env_arr.map |$var| { "-e ${var}" }, ' ')
}
if $tls_priorities != undef {
$tls_priorities_real = " -e PCMK_tls_priorities=${tls_priorities}"