Merge "Update client to account for 409 error in cluster actions"

This commit is contained in:
Zuul 2019-03-05 20:28:49 +00:00 committed by Gerrit Code Review
commit 6ec11214e9
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.scale_in_cluster(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.scale_out_cluster(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: