diff --git a/changelogs/fragments/360_syspatch_apply_patches_by_default.yml b/changelogs/fragments/360_syspatch_apply_patches_by_default.yml new file mode 100644 index 00000000000..2bc4262c941 --- /dev/null +++ b/changelogs/fragments/360_syspatch_apply_patches_by_default.yml @@ -0,0 +1,4 @@ +bugfixes: + - syspatch - fix bug where not setting ``apply=true`` would result in error (https://github.com/ansible-collections/community.general/pull/360). +deprecated_features: + - syspatch - deprecate the redundant ``apply`` argument (https://github.com/ansible-collections/community.general/pull/360). diff --git a/plugins/modules/system/syspatch.py b/plugins/modules/system/syspatch.py index 1a26f07b4fd..4d3ade639b5 100644 --- a/plugins/modules/system/syspatch.py +++ b/plugins/modules/system/syspatch.py @@ -1,12 +1,12 @@ #!/usr/bin/python -# Copyright: (c) 2019, Andrew Klaus +# Copyright: (c) 2019-2020, Andrew Klaus # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division, print_function) __metaclass__ = type -DOCUMENTATION = ''' +DOCUMENTATION = r''' --- module: syspatch @@ -14,18 +14,18 @@ description: - - "Manage OpenBSD system patches using syspatch" + - "Manage OpenBSD system patches using syspatch." options: apply: description: - - Apply all available system patches - default: False - required: false + - Apply all available system patches. + - By default, apply all patches. + - Deprecated. Will be removed in community.general 3.0.0. + default: yes revert: description: - - Revert system patches - required: false + - Revert system patches. type: str choices: [ all, one ] @@ -63,17 +63,17 @@ returned: always type: int stdout: - description: syspatch standard output + description: syspatch standard output. returned: always type: str sample: "001_rip6cksum" stderr: - description: syspatch standard error + description: syspatch standard error. returned: always type: str sample: "syspatch: need root privileges" reboot_needed: - description: Whether or not a reboot is required after an update + description: Whether or not a reboot is required after an update. returned: always type: bool sample: True @@ -85,7 +85,7 @@ def run_module(): # define available arguments/parameters a user can pass to the module module_args = dict( - apply=dict(type='bool'), + apply=dict(type='bool', default=True, removed_in_version='3.0.0', removed_from_collection='community.general'), revert=dict(type='str', choices=['all', 'one']) ) @@ -142,10 +142,10 @@ def syspatch_run(module): # http://openbsd-archive.7691.n7.nabble.com/Warning-applying-latest-syspatch-td354250.html if rc != 0 and err != 'ln: /usr/X11R6/bin/X: No such file or directory\n': module.fail_json(msg="Command %s failed rc=%d, out=%s, err=%s" % (cmd, rc, out, err)) - elif out.lower().find('create unique kernel') > 0: + elif out.lower().find('create unique kernel') >= 0: # Kernel update applied reboot_needed = True - elif out.lower().find('syspatch updated itself') > 0: + elif out.lower().find('syspatch updated itself') >= 0: warnings.append('Syspatch was updated. Please run syspatch again.') # If no stdout, then warn user