How to manage actions
> See also: juju:action
List all actions
To list the actions defined for a deployed application, use the get_actions() method on the Application object to get all the actions defined for this application.
await my_app.get_actions()
> See more: Application (object), get_actions (method)
Run an action
To run an action on a unit, use the run_action() method on a Unit object of a deployed application.
Note that “running” an action on a unit, enqueues an action to be performed. The result will be an Action object to interact with. You will need to call action.wait() on that object to wait for the action to complete and retrieve the results.
# Assume we deployed a git application
my_app = await model.deploy('git', application_name='git', channel='stable')
my_unit = my_app.units[0]
action = await my_unit.run_action('add-repo', repo='myrepo')
await action.wait() # will return the result for the action
> See more: Unit (object), Action (object), Unit.run_action (method), Action.wait() (method)