Merge "Fix actions to return immediately running on non-leader unit"

This commit is contained in:
Zuul 2021-05-07 21:07:19 +00:00 committed by Gerrit Code Review
commit 5e1827dde6

View File

@ -42,6 +42,7 @@ def authorize_charm_action(*args):
"""
if not hookenv.is_leader():
hookenv.action_fail('Please run action on lead unit')
return
action_config = hookenv.action_get()
role_id = vault.setup_charm_vault_access(action_config['token'])
hookenv.leader_set({vault.CHARM_ACCESS_ROLE_ID: role_id})
@ -59,6 +60,7 @@ def refresh_secrets(*args):
def get_intermediate_csrs(*args):
if not hookenv.is_leader():
hookenv.action_fail('Please run action on lead unit')
return
action_config = hookenv.action_get() or {}
csrs = vault_pki.get_csr(
ttl=action_config.get('ttl'),