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
|
#!/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)
|
# 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)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r'''
|
||||||
---
|
---
|
||||||
module: syspatch
|
module: syspatch
|
||||||
|
|
||||||
|
@ -14,18 +14,18 @@ short_description: Manage OpenBSD system patches
|
||||||
|
|
||||||
|
|
||||||
description:
|
description:
|
||||||
- "Manage OpenBSD system patches using syspatch"
|
- "Manage OpenBSD system patches using syspatch."
|
||||||
|
|
||||||
options:
|
options:
|
||||||
apply:
|
apply:
|
||||||
description:
|
description:
|
||||||
- Apply all available system patches
|
- Apply all available system patches.
|
||||||
default: False
|
- By default, apply all patches.
|
||||||
required: false
|
- Deprecated. Will be removed in community.general 3.0.0.
|
||||||
|
default: yes
|
||||||
revert:
|
revert:
|
||||||
description:
|
description:
|
||||||
- Revert system patches
|
- Revert system patches.
|
||||||
required: false
|
|
||||||
type: str
|
type: str
|
||||||
choices: [ all, one ]
|
choices: [ all, one ]
|
||||||
|
|
||||||
|
@ -63,17 +63,17 @@ rc:
|
||||||
returned: always
|
returned: always
|
||||||
type: int
|
type: int
|
||||||
stdout:
|
stdout:
|
||||||
description: syspatch standard output
|
description: syspatch standard output.
|
||||||
returned: always
|
returned: always
|
||||||
type: str
|
type: str
|
||||||
sample: "001_rip6cksum"
|
sample: "001_rip6cksum"
|
||||||
stderr:
|
stderr:
|
||||||
description: syspatch standard error
|
description: syspatch standard error.
|
||||||
returned: always
|
returned: always
|
||||||
type: str
|
type: str
|
||||||
sample: "syspatch: need root privileges"
|
sample: "syspatch: need root privileges"
|
||||||
reboot_needed:
|
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
|
returned: always
|
||||||
type: bool
|
type: bool
|
||||||
sample: True
|
sample: True
|
||||||
|
@ -85,7 +85,7 @@ from ansible.module_utils.basic import AnsibleModule
|
||||||
def run_module():
|
def run_module():
|
||||||
# define available arguments/parameters a user can pass to the module
|
# define available arguments/parameters a user can pass to the module
|
||||||
module_args = dict(
|
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'])
|
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
|
# 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':
|
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))
|
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
|
# Kernel update applied
|
||||||
reboot_needed = True
|
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.')
|
warnings.append('Syspatch was updated. Please run syspatch again.')
|
||||||
|
|
||||||
# If no stdout, then warn user
|
# If no stdout, then warn user
|
||||||
|
|
Loading…
Reference in a new issue