git://git.onelab.eu
/
plstackapi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4dd1072
)
Added awslib, for interacting with Amazon AWS.
author
Sapan Bhatia
<gwsapan@gmail.com>
Tue, 22 Jul 2014 04:22:58 +0000
(
00:22
-0400)
committer
Sapan Bhatia
<gwsapan@gmail.com>
Wed, 23 Jul 2014 20:25:14 +0000
(16:25 -0400)
planetstack/ec2_observer/awslib.py
[new file with mode: 0644]
patch
|
blob
diff --git a/planetstack/ec2_observer/awslib.py
b/planetstack/ec2_observer/awslib.py
new file mode 100644
(file)
index 0000000..
5df0768
--- /dev/null
+++ b/
planetstack/ec2_observer/awslib.py
@@ -0,0
+1,18
@@
+import os
+import json
+
+class AwsException(Exception):
+ pass
+
+def aws_run(cmd):
+ cmd = 'aws %s'%cmd
+ pipe = os.popen(cmd)
+ output_str = pipe.read()
+
+ if (not pipe.close()):
+ output = json.loads(output_str)
+ return output
+ else:
+ raise AwsException("Error: %s"%output_str)
+
+