mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
Bump version of main to 12.0.0; execute announced deprecations (#10883)
* Bump version to 12.0.0. * Remove deprecated modules and plugins. * state is now required. * Change default of prepend_hash from auto to never. * Remove support for force=''. * Always delegate 'debug'. * Remove ignore_value_none and ctx_ignore_none parameters. * Remove parameters on_success and on_failure. * Update BOTMETA. * Adjust docs reference. * Forgot required=True. * Fix changelog fragment. * Adjust unit tests. * Fix changelog. Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> --------- Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
@@ -13,22 +13,16 @@ from functools import wraps
|
||||
from ansible_collections.community.general.plugins.module_utils.mh.exceptions import ModuleHelperException
|
||||
|
||||
|
||||
def cause_changes(on_success=None, on_failure=None, when=None):
|
||||
# Parameters on_success and on_failure are deprecated and should be removed in community.general 12.0.0
|
||||
|
||||
def cause_changes(when=None):
|
||||
def deco(func):
|
||||
@wraps(func)
|
||||
def wrapper(self, *args, **kwargs):
|
||||
try:
|
||||
func(self, *args, **kwargs)
|
||||
if on_success is not None:
|
||||
self.changed = on_success
|
||||
elif when == "success":
|
||||
if when == "success":
|
||||
self.changed = True
|
||||
except Exception:
|
||||
if on_failure is not None:
|
||||
self.changed = on_failure
|
||||
elif when == "failure":
|
||||
if when == "failure":
|
||||
self.changed = True
|
||||
raise
|
||||
finally:
|
||||
|
||||
Reference in New Issue
Block a user