3 For api docs, see :class:`juju.unit.Unit`.
8 Run arbitrary commands on a unit with the
9 :meth:`juju.unit.Unit.run` method. This method blocks
10 the current coroutine until a result is available, and
11 returns a :class:`juju.action.Action` instance.
16 from juju.model import Model
19 await model.connect_current()
21 app = await model.deploy(
23 application_name='ubuntu',
28 for unit in app.units:
29 action = await unit.run('unit-get public-address')
32 action = await unit.run('uname -a')
38 Run actions on a unit with the
39 :meth:`juju.unit.Unit.run_action` method. This method
40 returns a :class:`juju.action.Action` instance immediately. To block until
41 the action completes, use the :meth:`juju.action.Action.wait` method, as
47 from juju.model import Model
50 await model.connect_current()
52 app = await model.deploy(
54 application_name='git',
59 for unit in app.units:
60 # run the 'add-repo' action, passing a 'repo' param
61 action = await unit.run_action('add-repo', repo='myrepo')
62 # wait for the action to complete
63 action = await action.wait()