X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=modules%2Flibjuju%2Fdocs%2Fnarrative%2Funit.rst;fp=modules%2Flibjuju%2Fdocs%2Fnarrative%2Funit.rst;h=0000000000000000000000000000000000000000;hb=9d18c22a0dc9e295adda50601fc5e2f45d2c9b8a;hp=5d6b48d2c128dbf37d0d94854a88fa9e54db4fbf;hpb=19c5cfca317615597be6bf1051e9d2fa903adb97;p=osm%2FN2VC.git diff --git a/modules/libjuju/docs/narrative/unit.rst b/modules/libjuju/docs/narrative/unit.rst deleted file mode 100644 index 5d6b48d..0000000 --- a/modules/libjuju/docs/narrative/unit.rst +++ /dev/null @@ -1,65 +0,0 @@ -Units -===== -For api docs, see :class:`juju.unit.Unit`. - - -Running Commands ----------------- -Run arbitrary commands on a unit with the -:meth:`juju.unit.Unit.run` method. This method blocks -the current coroutine until a result is available, and -returns a :class:`juju.action.Action` instance. - - -.. code:: python - - from juju.model import Model - - model = Model() - await model.connect_current() - - app = await model.deploy( - 'ubuntu', - application_name='ubuntu', - series='trusty', - channel='stable', - ) - - for unit in app.units: - action = await unit.run('unit-get public-address') - print(action.results) - - action = await unit.run('uname -a') - print(action.results) - - -Running Actions ---------------- -Run actions on a unit with the -:meth:`juju.unit.Unit.run_action` method. This method -returns a :class:`juju.action.Action` instance immediately. To block until -the action completes, use the :meth:`juju.action.Action.wait` method, as -in the example below. - - -.. code:: python - - from juju.model import Model - - model = Model() - await model.connect_current() - - app = await model.deploy( - 'git', - application_name='git', - series='trusty', - channel='stable', - ) - - for unit in app.units: - # run the 'add-repo' action, passing a 'repo' param - action = await unit.run_action('add-repo', repo='myrepo') - # wait for the action to complete - action = await action.wait() - - print(action.results)