Skip to content

Commit

Permalink
Fix cluster deployment state setting and result handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Tengler committed Nov 10, 2017
1 parent 99f38db commit 3e9491a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,5 @@ ENV/
node_modules/

# DO NOT COMMIT LOCAL CONFIG
kqueen/config_local.py
kqueen/config/local.py

10 changes: 9 additions & 1 deletion kqueen/blueprints/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,20 @@ def after_save(self):

if not prov_status:
logger.error('Provisioning failed: {}'.format(prov_msg))
abort(500)
abort(500, description=prov_msg)


class GetCluster(GetView):
object_class = Cluster

def dispatch_request(self, *args, **kwargs):
self.check_access()

cluster = self.get_content(*args, **kwargs)
cluster.get_state()

return jsonify(cluster)


class UpdateCluster(UpdateView):
object_class = Cluster
Expand Down
6 changes: 3 additions & 3 deletions kqueen/engines/jenkins.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ def provision(self, **kwargs):
ctx['STACK_NAME'] = 'KQUEEN__{}'.format(cluster_id)
try:
self.client.build_job(self.provision_job_name, ctx)
return (True, None)
return True, None
except Exception as e:
msg = 'Creating cluster {} failed with following reason: {}'.format(cluster_id, repr(e))
logger.error(msg)
return (False, msg)
return (None, None)
return False, msg
return None, None

def deprovision(self, **kwargs):
"""
Expand Down

0 comments on commit 3e9491a

Please sign in to comment.