Add container_cli used for the Overcloud to the Inventory

Some validations run commands on multiple containers and have to know if
the Overcloud has been deployed using Docker or Podman.

This patch gets the 'ContainerCli' variable from the Overcloud stack
environment and adds it as an Overcloud vars.

Change-Id: I7541bfd244acaf1d00d18b3eef031dbadfe4dd4a
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
This commit is contained in:
Gael Chamoulaud 2019-03-19 14:29:18 +01:00
parent 2c5d3f5f7d
commit 3153c449a2
2 changed files with 16 additions and 6 deletions

View File

@ -268,12 +268,18 @@ class TripleoInventory(object):
if children:
vip_map = self.stack_outputs.get('VipMap', {})
vips = {(vip_name + "_vip"): vip
for vip_name, vip in vip_map.items()
if vip and (vip_name in networks or vip_name == 'redis')}
overcloud_vars = {
(vip_name + "_vip"): vip for vip_name, vip in vip_map.items()
if vip and (vip_name in networks or vip_name == 'redis')
}
overcloud_vars['container_cli'] = \
self.get_overcloud_environment().get(
'parameter_defaults', {}).get('ContainerCli')
ret['overcloud'] = {
'children': self._hosts(sorted(children)),
'vars': vips
'vars': overcloud_vars
}
# Associate services with roles

View File

@ -104,7 +104,8 @@ class TestInventory(base.TestCase):
self.hclient = MagicMock()
self.hclient.stacks.environment.return_value = {
'parameter_defaults': {'AdminPassword': 'theadminpw'}}
'parameter_defaults': {'AdminPassword': 'theadminpw',
'ContainerCli': 'podman'}}
self.mock_stack = MagicMock()
self.mock_stack.outputs = self.outputs_data['outputs']
self.hclient.stacks.get.return_value = self.mock_stack
@ -195,6 +196,7 @@ class TestInventory(base.TestCase):
'overcloud': {
'children': ['Compute', 'Controller', 'CustomRole'],
'vars': {
'container_cli': 'podman',
'ctlplane_vip': 'x.x.x.4',
'redis_vip': 'x.x.x.6'}},
'Undercloud': {
@ -275,6 +277,7 @@ class TestInventory(base.TestCase):
'overcloud': {
'children': ['Compute', 'Controller', 'CustomRole'],
'vars': {
'container_cli': 'podman',
'ctlplane_vip': 'x.x.x.4',
'redis_vip': 'x.x.x.6'}},
'Undercloud': {
@ -366,7 +369,8 @@ class TestInventory(base.TestCase):
'overcloud': {'children': {'Compute': {},
'Controller': {},
'CustomRole': {}},
'vars': {'ctlplane_vip': 'x.x.x.4',
'vars': {'container_cli': 'podman',
'ctlplane_vip': 'x.x.x.4',
'redis_vip': 'x.x.x.6'}},
'sa': {'children': {'Controller': {}},
'vars': {'ansible_ssh_user': 'heat-admin'}},