in gstack/controllers/operations.py [0:0]
def _get_instance_async_response(async_result, projectid, type):
response = {}
response['kind'] = 'compute#operation'
response['id'] = async_result['jobid']
response['operationType'] = type
response['name'] = async_result['jobid']
response['insertTime'] = async_result['created']
response['startTime'] = async_result['created']
response['selfLink'] = urllib.unquote_plus(
helpers.get_root_url() + url_for(
'getoperations',
projectid=projectid,
operationid=async_result['jobid']
))
if async_result['jobstatus'] is 0:
response['targetLink'] = ''
response['status'] = 'PENDING'
response['progress'] = 0
elif async_result['jobstatus'] is 1:
response['status'] = 'DONE'
response['zone'] = urllib.unquote_plus(
helpers.get_root_url() +
url_for(
'getzone',
projectid=projectid,
zone=async_result['jobresult']['virtualmachine']['zonename'],
))
response['targetLink'] = urllib.unquote_plus(
helpers.get_root_url() +
url_for(
'getinstance',
projectid=projectid,
zone=async_result['jobresult']['virtualmachine']['zonename'],
instance=async_result['jobresult']['virtualmachine']['name']))
return response