6 Run arbitrary commands on a unit with the
7 :meth:`juju.unit.Unit.run` method. This method blocks
8 the current coroutine until a result is available, and
9 returns a :class:`juju.action.Action` instance.
14 from juju.model import Model
17 await model.connect_current()
19 app = await model.deploy(
21 application_name='ubuntu',
26 for unit in app.units:
27 action = await unit.run('unit-get public-address')
30 action = await unit.run('uname -a')
36 Run actions on a unit with the
37 :meth:`juju.unit.Unit.run_action` method. This method
38 returns a :class:`juju.action.Action` instance immediately. To block until
39 the action completes, use the :meth:`juju.action.Action.wait` method, as
45 from juju.model import Model
48 await model.connect_current()
50 app = await model.deploy(
52 application_name='git',
57 for unit in app.units:
58 # run the 'add-repo' action, passing a 'repo' param
59 action = await unit.run_action('add-repo', repo='myrepo')
60 # wait for the action to complete
61 action = await action.wait()