Skip to content

Commit

Permalink
Capture outputs description and repeat delete
Browse files Browse the repository at this point in the history
  • Loading branch information
miha-plesko committed Apr 15, 2016
1 parent 144898b commit 5972599
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
25 changes: 21 additions & 4 deletions dice_deploy_django/cfy_wrapper/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,17 @@ def delete_blueprint(blueprint_id, delete_local=True):

logger.info("Deleting blueprint '{}'. delete_local={}".format(blueprint_id, delete_local))

# Next call will block until upload is finished (can take some time)
client.blueprints.delete(blueprint_id)
# Next call fails sometimes if called to fast after deleting deployment.
# Retry few times to solve the problem
num_retries = 10
for i in range(num_retries):
try:
client.blueprints.delete(blueprint_id)
break
except Exception, e:
logger.warning("Could not delete blueprint from cfy, attempt: %d/%d. Error: %s" %
(i+1, num_retries, e))
time.sleep(2)

blueprint = Blueprint.get(blueprint_id)
if delete_local:
Expand All @@ -203,5 +212,13 @@ def delete_blueprint(blueprint_id, delete_local=True):

def get_outputs(blueprint):
client = utils.get_cfy_client()
outputs_raw = client.deployments.outputs.get(blueprint.cfy_id)
return outputs_raw.get('outputs', {})
outputs_descriptions = client.deployments.get(blueprint.cfy_id).get('outputs', {})
outputs = client.deployments.outputs.get(blueprint.cfy_id).get('outputs', {})

for key, value in outputs.iteritems():
outputs[key] = {
'value': value,
'description': outputs_descriptions.get(key, {}).get('description', '')
}

return outputs
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@
</tr>
</thead>
<tbody class="dice-outputs-tbody">
<tr ng-repeat="(name, value) in cont.blueprint.outputs">
<tr ng-repeat="(name, valueObj) in cont.blueprint.outputs">
<td>{{ name }}</td>
<td ng-bind-html="value | linky:'_blank'"></td>
<td>Parameter description</td>
<td ng-bind-html="valueObj.value | linky:'_blank'"></td>
<td>{{ valueObj.description }}</td>
</tr>
</tbody>
</table>
Expand Down

0 comments on commit 5972599

Please sign in to comment.