Revision 4cf8adf8 tools/cloud
b/tools/cloud | ||
---|---|---|
82 | 82 |
buf = resp.read() or '{}' |
83 | 83 |
reply = json.loads(buf) |
84 | 84 |
|
85 |
# If the response status is not the expected one, |
|
86 |
# assume an error has occured and treat the body |
|
87 |
# as a cloudfault. |
|
85 | 88 |
if resp.status != expected_status: |
86 | 89 |
if len(reply) == 1: |
87 | 90 |
key = reply.keys()[0] |
... | ... | |
241 | 244 |
|
242 | 245 |
def execute(self, server_id): |
243 | 246 |
path = '/api/%s/servers/%d/action' % (self.api, int(server_id)) |
244 |
body = json.dumps({'console':{'type':'VNC'}})
|
|
245 |
reply = self.http_post(path, body)
|
|
246 |
print_dict(reply) |
|
247 |
body = json.dumps({'console':{'type':'vnc'}})
|
|
248 |
reply = self.http_cmd('POST', path, body, 200)
|
|
249 |
print_dict(reply['vnc'])
|
|
247 | 250 |
|
248 | 251 |
|
249 | 252 |
@command_name('lsaddr') |
Also available in: Unified diff