1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

[aerospike_migrations] - handle exception for unstable-cluster (#900)

* [aerospike_migrations] - handle exception when unstable-cluster is returned

* fix lint issue

* Update changelogs/fragments/900-aerospike-migration-handle-unstable-cluster.yaml

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Kailun Shi <kaishi@adobe.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Kailun 2020-09-24 22:38:48 -07:00 committed by GitHub
parent cf450e3a43
commit 62ae120c50
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -0,0 +1,3 @@
---
bugfixes:
- aerospike_migrations - handle exception when unstable-cluster is returned (https://github.com/ansible-collections/community.general/pull/900).

View file

@ -439,7 +439,12 @@ class Migrations:
if target_cluster_size is not None:
cmd = cmd + "size=" + str(target_cluster_size) + ";"
for node in self._nodes:
cluster_key.add(self._info_cmd_helper(cmd, node))
try:
cluster_key.add(self._info_cmd_helper(cmd, node))
except aerospike.exception.ServerError as e: # unstable-cluster is returned in form of Exception
if 'unstable-cluster' in e.msg:
return False
raise e
if len(cluster_key) == 1:
return True
return False