mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Make sure to clean up even if an exception occurs (#50620)
This commit is contained in:
parent
2dbade4adc
commit
9a520b26e3
1 changed files with 11 additions and 10 deletions
|
@ -61,8 +61,9 @@ def setup_env(filename):
|
||||||
setattr(module.AnsibleModule, '__init__', fake)
|
setattr(module.AnsibleModule, '__init__', fake)
|
||||||
setattr(module, '_load_params', _fake_load_params)
|
setattr(module, '_load_params', _fake_load_params)
|
||||||
|
|
||||||
|
try:
|
||||||
yield fake
|
yield fake
|
||||||
|
finally:
|
||||||
setattr(module.AnsibleModule, '__init__', _original_init)
|
setattr(module.AnsibleModule, '__init__', _original_init)
|
||||||
setattr(module, '_load_params', _original_load_params)
|
setattr(module, '_load_params', _original_load_params)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue