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) (#959)

* [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>
(cherry picked from commit 62ae120c50)

Co-authored-by: Kailun <kailun.shi@gmail.com>
This commit is contained in:
patchback[bot] 2020-09-25 08:17:56 +02:00 committed by GitHub
parent d8328312a1
commit 5b425fc297
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: if target_cluster_size is not None:
cmd = cmd + "size=" + str(target_cluster_size) + ";" cmd = cmd + "size=" + str(target_cluster_size) + ";"
for node in self._nodes: 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: if len(cluster_key) == 1:
return True return True
return False return False