Set a default environment label if empty

When the operator doesn't define an environment label, it will default
to "env-<environment id>".

Change-Id: Ied260dc7b65c1c08d922858a1ef620cb43d58609
This commit is contained in:
Simon Pasquier 2016-01-28 11:27:24 +01:00
parent 6a14d3d50a
commit ef4c99b199
3 changed files with 12 additions and 14 deletions

View File

@ -30,19 +30,17 @@ $es_nodes = filter_nodes(hiera('nodes'), 'role', 'elasticsearch_kibana')
$influxdb_grafana = hiera_hash('influxdb_grafana', {})
$influxdb_nodes = filter_nodes(hiera('nodes'), 'role', 'influxdb_grafana')
$tags = {
deployment_id => hiera('deployment_id'),
openstack_region => 'RegionOne',
openstack_release => hiera('openstack_version'),
openstack_roles => join($roles, ','),
}
if $lma_collector['environment_label'] != '' {
$additional_tags = {
environment_label => $lma_collector['environment_label'],
}
$environment_label = $lma_collector['environment_label']
} else {
$environment_label = join(['env-', hiera('deployment_id')], '')
}
else {
$additional_tags = {}
$tags = {
deployment_id => hiera('deployment_id'),
openstack_region => 'RegionOne',
openstack_release => hiera('openstack_version'),
openstack_roles => join($roles, ','),
environment_label => $environment_label,
}
if $is_controller {
@ -104,7 +102,7 @@ if $is_controller{
}
class { 'lma_collector':
tags => merge($tags, $additional_tags),
tags => $tags,
groups => $additional_groups,
pacemaker_managed => $pacemaker_managed,
rabbitmq_resource => $rabbitmq_resource,

View File

@ -44,7 +44,7 @@ Attributes in **bold** are always present in the messages while attributes in
* **openstack_roles** (string), a comma-separated list of the node's roles (eg
'controller', 'compute,cinder').
* *environment_label* (string), the label assigned to the OpenStack
* **environment_label** (string), the label assigned to the OpenStack
environment.
.. note:: All date/time fields represented as string are formatted according

View File

@ -7,7 +7,7 @@ attributes:
environment_label:
value: ''
label: 'Environment label'
description: 'Optional string to tag the data.'
description: 'Optional string to tag the data. If empty, it will default to "env-<environment id>".'
weight: 10
type: "text"