You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2019/12/21 11:45:49 UTC

[libcloud] 09/09: Add some docs on how to access the output of a deployment step.

This is an automated email from the ASF dual-hosted git repository.

tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git

commit dc494b582d8e90b456d5d6c49c54ea90548232db
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Sat Dec 21 12:39:06 2019 +0100

    Add some docs on how to access the output of a deployment step.
---
 docs/compute/deployment.rst              | 20 +++++++++++++++++++-
 docs/examples/compute/gce/deploy_node.py |  1 -
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/docs/compute/deployment.rst b/docs/compute/deployment.rst
index 0270d26..f9b1cc5 100644
--- a/docs/compute/deployment.rst
+++ b/docs/compute/deployment.rst
@@ -117,10 +117,28 @@ method and a couple of additional arguments. The most important ones are
   authenticate. Key needs to be in a format which is supported by paramiko
   (see section on supported key types above).
 * ``ssh_username`` - SSH username used to login. If not provided, it defaults
-  to ``root``
+  to ``root``.
 * ``ssh_port`` - Port of the SSH server. If not provided, it defaults to
   ``22``.
 
+To view the output (stdout, stderr) and exit code of a specific deployment
+step, you can access ``stdout``, ``stderr`` and ``exit_status`` instance
+variables on the deployment class instance (``ScriptDeployment``,
+``ScriptFileDeployment``) in question.
+
+For example:
+
+.. sourcecode:: python
+
+    ...
+    step = ScriptDeployment("echo whoami ; date ; ls -la")
+
+    node = driver.deploy_node(...)
+
+    print('stdout: %s' % (step.stdout))
+    print('stderr: %s' % (step.stderr))
+    print('exit_code: %s' % (step.exit_status))
+
 Some examples which demonstrate how this method can be used are displayed
 below.
 
diff --git a/docs/examples/compute/gce/deploy_node.py b/docs/examples/compute/gce/deploy_node.py
index 10518ab..26cec6f 100644
--- a/docs/examples/compute/gce/deploy_node.py
+++ b/docs/examples/compute/gce/deploy_node.py
@@ -64,7 +64,6 @@ node = driver.deploy_node(name='libcloud-deploy-demo-1', image=image,
 print('')
 print('Node: %s' % (node))
 print('')
-print('stdout: %s' % (step))
 print('stdout: %s' % (step.stdout))
 print('stderr: %s' % (step.stderr))
 print('exit_code: %s' % (step.exit_status))