blob: ca708ff6d82b7bc804d5d75d5e0e50c766e08104 [file] [log] [blame]
Sapan Bhatiacf06d6f2014-07-22 00:22:58 -04001import os
2import json
3
4class AwsException(Exception):
5 pass
6
Sapan Bhatia76240082014-09-08 03:26:35 -04007def aws_run(cmd,env=''):
8 cmd = '%s aws %s'%(env,cmd)
Sapan Bhatiacf06d6f2014-07-22 00:22:58 -04009 pipe = os.popen(cmd)
10 output_str = pipe.read()
11
12 if (not pipe.close()):
13 output = json.loads(output_str)
14 return output
15 else:
16 raise AwsException("Error: %s"%output_str)
17
18