+ actions = await self.libjuju.get_actions(
+ application_name=application_name, model_name=model_name,
+ )
+ self.log.debug(
+ "Application {} has these actions: {}".format(
+ application_name, actions
+ )
+ )
+ if "verify-ssh-credentials" in actions:
+ # execute verify-credentials
+ num_retries = 20
+ retry_timeout = 15.0
+ for _ in range(num_retries):
+ try:
+ self.log.debug("Executing action verify-ssh-credentials...")
+ output, ok = await self.libjuju.execute_action(
+ model_name=model_name,
+ application_name=application_name,
+ action_name="verify-ssh-credentials",
+ db_dict=db_dict,
+ progress_timeout=progress_timeout,
+ total_timeout=total_timeout,
+ )
+ self.log.debug("Result: {}, output: {}".format(ok, output))
+ break
+ except asyncio.CancelledError:
+ raise
+ except Exception as e:
+ self.log.debug(
+ "Error executing verify-ssh-credentials: {}. Retrying...".format(
+ e
+ )
+ )
+ await asyncio.sleep(retry_timeout)
+ else:
+ self.log.error(
+ "Error executing verify-ssh-credentials after {} retries. ".format(
+ num_retries
+ )
+ )
+ else:
+ msg = "Action verify-ssh-credentials does not exist in application {}".format(
+ application_name
+ )
+ self.log.debug(msg=msg)