Module instance sort en erreur si la procédure n’est pas allé jusqu’au bout
This commit is contained in:
parent
2e94186bef
commit
b553f77ead
@ -335,6 +335,7 @@ def run_module():
|
|||||||
for expectation_name, response in module.params['variables'].items():
|
for expectation_name, response in module.params['variables'].items():
|
||||||
expectations.set_expectation_response_by_name(expectation_name, response)
|
expectations.set_expectation_response_by_name(expectation_name, response)
|
||||||
|
|
||||||
|
try:
|
||||||
instance_process = pexpect.spawn(cmd, encoding='utf-8', timeout=60)
|
instance_process = pexpect.spawn(cmd, encoding='utf-8', timeout=60)
|
||||||
|
|
||||||
some_index = 0
|
some_index = 0
|
||||||
@ -353,6 +354,11 @@ def run_module():
|
|||||||
some_index += 1
|
some_index += 1
|
||||||
result['changed'] = True
|
result['changed'] = True
|
||||||
result['msg'] += f"Module {result['module']} instanciated"
|
result['msg'] += f"Module {result['module']} instanciated"
|
||||||
|
module.exit_json(**result)
|
||||||
|
except Exception as err:
|
||||||
|
result['msg'] += err
|
||||||
|
result['changed'] = True
|
||||||
|
module.fail_json(**result)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -369,7 +375,6 @@ def run_module():
|
|||||||
|
|
||||||
# in the event of a successful module execution, you will want to
|
# in the event of a successful module execution, you will want to
|
||||||
# simple AnsibleModule.exit_json(), passing the key/value results
|
# simple AnsibleModule.exit_json(), passing the key/value results
|
||||||
module.exit_json(**result)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
Loading…
Reference in New Issue
Block a user