Read stack output to get AdminPassword
We are currently using environment API to obtain AdminPassword but the API no longer shows the secret informations. This updates the logic to use the stack output instead. Conflicts: tripleo_common/inventory.py tripleo_common/tests/test_inventory.py Closes-Bug: #2006125 Change-Id: I788f7b52cad8008e1a1fbd1329d51606cee262fe (cherry picked from commit010c9aeb56
) (cherry picked from commit6f3b270a31
)
This commit is contained in:
parent
99d0f057e7
commit
8d2c05f395
|
@ -218,14 +218,14 @@ class TripleoInventory(object):
|
|||
return ret
|
||||
|
||||
ret['Undercloud']['vars']['plan'] = self.plan_name
|
||||
admin_password = self.get_overcloud_environment().get(
|
||||
'parameter_defaults', {}).get('AdminPassword')
|
||||
|
||||
self.stack_outputs = StackOutputs(self.stack)
|
||||
|
||||
admin_password = self.stack_outputs.get('AdminPassword')
|
||||
if admin_password:
|
||||
ret['Undercloud']['vars']['overcloud_admin_password'] =\
|
||||
admin_password
|
||||
|
||||
self.stack_outputs = StackOutputs(self.stack)
|
||||
|
||||
keystone_url = self.stack_outputs.get('KeystoneURL')
|
||||
if keystone_url:
|
||||
ret['Undercloud']['vars']['overcloud_keystone_url'] = keystone_url
|
||||
|
|
|
@ -65,6 +65,8 @@ class TestInventory(base.TestCase):
|
|||
'CustomRole': ['sg', 'sh']}},
|
||||
{'output_key': 'KeystoneURL',
|
||||
'output_value': 'xyz://keystone'},
|
||||
{'output_key': 'AdminPassword',
|
||||
'output_value': 'theadminpw'},
|
||||
{'output_key': 'ServerIdData',
|
||||
'output_value': {
|
||||
'server_ids': {
|
||||
|
@ -111,8 +113,7 @@ class TestInventory(base.TestCase):
|
|||
|
||||
self.hclient = MagicMock()
|
||||
self.hclient.stacks.environment.return_value = {
|
||||
'parameter_defaults': {'AdminPassword': 'theadminpw',
|
||||
'ContainerCli': 'podman'}}
|
||||
'parameter_defaults': {'ContainerCli': 'podman'}}
|
||||
self.mock_stack = MagicMock()
|
||||
self.mock_stack.outputs = self.outputs_data['outputs']
|
||||
self.hclient.stacks.get.return_value = self.mock_stack
|
||||
|
@ -189,7 +190,7 @@ class TestInventory(base.TestCase):
|
|||
|
||||
def test_outputs_iterating_returns_list_of_output_keys(self):
|
||||
self.assertEqual(
|
||||
{'EnabledServices', 'KeystoneURL', 'ServerIdData',
|
||||
{'AdminPassword', 'EnabledServices', 'KeystoneURL', 'ServerIdData',
|
||||
'RoleNetHostnameMap', 'RoleNetIpMap', 'VipMap',
|
||||
'RoleData'},
|
||||
set([o for o in self.outputs]))
|
||||
|
|
Loading…
Reference in New Issue