Handle Vault running tests twice (#588)

Vault's runs its tests twice. In some circumstances the removal of the
vault key from the test_config dictionary can throw a KeyError. Do not
fail when this happens.
This commit is contained in:
David Ames
2021-06-09 03:20:53 -07:00
committed by GitHub
parent 962e75a054
commit 6645c60e93

View File

@@ -111,7 +111,11 @@ class UnsealVault(BaseVaultTest):
vault_utils.run_charm_authorize(self.vault_creds['root_token'])
if not test_config:
test_config = lifecycle_utils.get_charm_config()
del test_config['target_deploy_status']['vault']
try:
del test_config['target_deploy_status']['vault']
except KeyError:
# Already removed
pass
zaza.model.wait_for_application_states(
states=test_config.get('target_deploy_status', {}))
@@ -154,7 +158,11 @@ class VaultTest(BaseVaultTest):
allowed_domains='openstack.local')
test_config = lifecycle_utils.get_charm_config()
del test_config['target_deploy_status']['vault']
try:
del test_config['target_deploy_status']['vault']
except KeyError:
# Already removed
pass
zaza.openstack.utilities.openstack.block_until_ca_exists(
'keystone',
cacert.decode().strip())