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:42 UTC
[libcloud] 02/09: For easier debugging and troubleshooting add
__repr__ and __str__ to ScriptDeployment class.
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 d23db725f5495a5d025efba9d8f2a3aaa7fd9e2d
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Sat Dec 21 12:17:45 2019 +0100
For easier debugging and troubleshooting add __repr__ and __str__ to
ScriptDeployment class.
---
libcloud/compute/deployment.py | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/libcloud/compute/deployment.py b/libcloud/compute/deployment.py
index 7dca950..306a6a2 100644
--- a/libcloud/compute/deployment.py
+++ b/libcloud/compute/deployment.py
@@ -209,6 +209,22 @@ class ScriptDeployment(Deployment):
return node
+ def __str__(self):
+ return self.__repr__()
+
+ def __repr__(self):
+ script = self.script[:15] + '...'
+ exit_status = self.exit_status
+
+ if exit_status is not None:
+ stdout = self.stdout[:30] + '...'
+ stderr = self.stderr[:30] + '...'
+ else:
+ stdout = None
+ stderr = None
+ return ("<ScriptDeployment script=%s, exit_status=%s, stdout=%s,"
+ "stderr=%s>" % (script, exit_status, stdout, stderr))
+
class ScriptFileDeployment(ScriptDeployment):
"""