Update client to account for 409 error in cluster actions

This patch allows the senlin client to properly parse a 409
error when a scaling action fails due to a conflict or cooldown

Depends-On: https://review.openstack.org/585573
Change-Id: I2fff7c2cc1bb17c0e32ef5b67294b811aff22192
This commit is contained in:
Jude Cross 2018-07-25 14:09:20 -07:00
parent 162c5c289a
commit 87b7b13ea9
2 changed files with 10 additions and 0 deletions

2
.gitignore vendored
View File

@ -38,6 +38,8 @@ cover/
htmlcov/
.tox/
.coverage
.coverage.*
.idea
.cache
.stestr/
coverage.xml

View File

@ -535,6 +535,10 @@ class ScaleInCluster(command.Command):
resp = senlin_client.cluster_scale_in(parsed_args.cluster,
parsed_args.count)
status_code = resp.get('code', None)
if status_code in [409]:
raise exc.CommandError(_(
'Unable to scale in cluster: %s') % resp['error']['message'])
if 'action' in resp:
print('Request accepted by action: %s' % resp['action'])
else:
@ -566,6 +570,10 @@ class ScaleOutCluster(command.Command):
resp = senlin_client.cluster_scale_out(parsed_args.cluster,
parsed_args.count)
status_code = resp.get('code', None)
if status_code in [409]:
raise exc.CommandError(_(
'Unable to scale out cluster: %s') % resp['error']['message'])
if 'action' in resp:
print('Request accepted by action: %s' % resp['action'])
else: