Created
April 12, 2016 08:47
-
-
Save tamirko/94139dcc4b9fc3fa534ed53f91bdf163 to your computer and use it in GitHub Desktop.
How to delete a Cloudify deployment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
from cloudify_rest_client.executions import Execution | |
from cloudify_cli.utils import get_rest_client | |
client = get_rest_client() | |
deployment_id = sys.argv[1] | |
print 'Canceling bad executions for deployment {0}'.format(deployment_id) | |
for execution in client.executions.list(deployment_id=deployment_id): | |
if execution.status not in Execution.END_STATES: | |
print 'Updating execution {0} to state {1}'.format(execution.id, Execution.CANCELLED) | |
client.executions.update(execution.id, Execution.CANCELLED) | |
print 'Deleting deployment: {0}'.format(deployment_id) | |
client.deployments.delete(deployment_id) | |
print 'Deployment deleted successfully' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment