diff --git a/changelogs/fragments/900-aerospike-migration-handle-unstable-cluster.yaml b/changelogs/fragments/900-aerospike-migration-handle-unstable-cluster.yaml new file mode 100644 index 0000000000..ac8c0d0869 --- /dev/null +++ b/changelogs/fragments/900-aerospike-migration-handle-unstable-cluster.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: + - aerospike_migrations - handle exception when unstable-cluster is returned (https://github.com/ansible-collections/community.general/pull/900). diff --git a/plugins/modules/database/aerospike/aerospike_migrations.py b/plugins/modules/database/aerospike/aerospike_migrations.py index 6f9d9c017a..27bfc1a95b 100644 --- a/plugins/modules/database/aerospike/aerospike_migrations.py +++ b/plugins/modules/database/aerospike/aerospike_migrations.py @@ -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