mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
* Apply patches by default. Other minor cleanup
* syspatch: Adding changelog and deprecating redundant apply argument
* Update changelogs/fragments/360_syspatch_apply_patches_by_default.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit b7713830dc
)
Co-authored-by: Andrew Klaus <andrew@aklaus.ca>
This commit is contained in:
parent
5d0a0d27e5
commit
88bd8fc7ea
2 changed files with 18 additions and 14 deletions
|
@ -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).
|
|
@ -1,12 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# Copyright: (c) 2019, Andrew Klaus <andrewklaus@gmail.com>
|
||||
# Copyright: (c) 2019-2020, Andrew Klaus <andrewklaus@gmail.com>
|
||||
# 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 @@ short_description: Manage OpenBSD system patches
|
|||
|
||||
|
||||
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 @@ rc:
|
|||
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 @@ from ansible.module_utils.basic import AnsibleModule
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue