Fix purefa_host preferred array connection logic (#65917)

This commit is contained in:
Simon Dodsley 2019-12-17 07:46:10 -08:00 committed by ansibot
parent 9b85a51c64
commit 42144204f3

View file

@ -452,12 +452,13 @@ def main():
if not all_connected_arrays: if not all_connected_arrays:
module.fail_json(msg='No target arrays connected to source array. Setting preferred arrays not possible.') module.fail_json(msg='No target arrays connected to source array. Setting preferred arrays not possible.')
else: else:
current_arrays = [] current_arrays = [array.get()['array_name']]
for current_array in range(0, len(all_connected_arrays)): for current_array in range(0, len(all_connected_arrays)):
current_arrays.append(all_connected_arrays[current_array]['array_name']) if all_connected_arrays[current_array]['type'] == "sync-replication":
current_arrays.append(all_connected_arrays[current_array]['array_name'])
for array_to_connect in range(0, len(module.params['preferred_array'])): for array_to_connect in range(0, len(module.params['preferred_array'])):
if module.params['preferred_array'][array_to_connect] not in current_arrays: if module.params['preferred_array'][array_to_connect] not in current_arrays:
module.fail_json(msg='Array {0} not in existing array connections.'.format(module.params['preferred_array'][array_to_connect])) module.fail_json(msg='Array {0} is not a synchronously connected array.'.format(module.params['preferred_array'][array_to_connect]))
except Exception: except Exception:
module.fail_json(msg='Failed to get existing array connections.') module.fail_json(msg='Failed to get existing array connections.')