Skip to content

Commit 5972599

Browse files
author
Miha Pleško
committed
Capture outputs description and repeat delete
Referes: * https://trello.com/c/pBChepuJ/64-parameter-description
1 parent 144898b commit 5972599

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

dice_deploy_django/cfy_wrapper/tasks.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,17 @@ def delete_blueprint(blueprint_id, delete_local=True):
184184

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

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

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

204213
def get_outputs(blueprint):
205214
client = utils.get_cfy_client()
206-
outputs_raw = client.deployments.outputs.get(blueprint.cfy_id)
207-
return outputs_raw.get('outputs', {})
215+
outputs_descriptions = client.deployments.get(blueprint.cfy_id).get('outputs', {})
216+
outputs = client.deployments.outputs.get(blueprint.cfy_id).get('outputs', {})
217+
218+
for key, value in outputs.iteritems():
219+
outputs[key] = {
220+
'value': value,
221+
'description': outputs_descriptions.get(key, {}).get('description', '')
222+
}
223+
224+
return outputs

dice_deploy_django/cfy_wrapper_gui/static/partials/containers.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,10 @@
106106
</tr>
107107
</thead>
108108
<tbody class="dice-outputs-tbody">
109-
<tr ng-repeat="(name, value) in cont.blueprint.outputs">
109+
<tr ng-repeat="(name, valueObj) in cont.blueprint.outputs">
110110
<td>{{ name }}</td>
111-
<td ng-bind-html="value | linky:'_blank'"></td>
112-
<td>Parameter description</td>
111+
<td ng-bind-html="valueObj.value | linky:'_blank'"></td>
112+
<td>{{ valueObj.description }}</td>
113113
</tr>
114114
</tbody>
115115
</table>

0 commit comments

Comments
 (0)