From 73eadbb86f70db73d840da74740c85b13a7fca34 Mon Sep 17 00:00:00 2001 From: Joseph Benden Date: Mon, 27 Apr 2020 14:30:45 -0700 Subject: [PATCH] ansible: update to 2.9.9. Signed-off-by: Joseph Benden --- ...f5e4b300aa8ce6c88a967298fc26ee471e42.patch | 94 +++++++++++++++++++ .../ansible/patches/service-dragonfly.patch | 29 ++++++ srcpkgs/ansible/template | 6 +- 3 files changed, 126 insertions(+), 3 deletions(-) create mode 100644 srcpkgs/ansible/patches/e74cf5e4b300aa8ce6c88a967298fc26ee471e42.patch create mode 100644 srcpkgs/ansible/patches/service-dragonfly.patch diff --git a/srcpkgs/ansible/patches/e74cf5e4b300aa8ce6c88a967298fc26ee471e42.patch b/srcpkgs/ansible/patches/e74cf5e4b300aa8ce6c88a967298fc26ee471e42.patch new file mode 100644 index 00000000000..8ce65ae9bd2 --- /dev/null +++ b/srcpkgs/ansible/patches/e74cf5e4b300aa8ce6c88a967298fc26ee471e42.patch @@ -0,0 +1,94 @@ +From e74cf5e4b300aa8ce6c88a967298fc26ee471e42 Mon Sep 17 00:00:00 2001 +From: Andrew Klaus +Date: Sun, 24 Nov 2019 21:15:15 -0700 +Subject: [PATCH] Fix: OpenBSD syspatch module bug (#57259) + +* Append is not a list + +* Adding new example. Renaming reboot var to match other modules + +* syspatch: Fixing if statement logic issue to properly compare integer + +* Syspatch: Using get_bin_path to find path. Revert to reboot_needed instead of reboot_required. + +* syspatch: Fix wording in playbook example +--- + lib/ansible/modules/system/syspatch.py | 28 +++++++++++++++++--------- + 1 file changed, 19 insertions(+), 9 deletions(-) + +diff --git a/lib/ansible/modules/system/syspatch.py b/lib/ansible/modules/system/syspatch.py +index 017cfbc7d603f..3c75f2f2c0b7c 100644 +--- a/lib/ansible/modules/system/syspatch.py ++++ b/lib/ansible/modules/system/syspatch.py +@@ -52,6 +52,16 @@ + - name: Revert all patches + syspatch: + revert: all ++ ++# NOTE: You can reboot automatically if a patch requires it: ++- name: Apply all patches and store result ++ syspatch: ++ apply: true ++ register: syspatch ++ ++- name: Reboot if patch requires it ++ reboot: ++ when: syspatch.reboot_needed + ''' + + RETURN = r''' +@@ -82,7 +92,7 @@ + def run_module(): + # define available arguments/parameters a user can pass to the module + module_args = dict( +- apply=dict(type='bool', default=False), ++ apply=dict(type='bool'), + revert=dict(type='str', choices=['all', 'one']) + ) + +@@ -98,7 +108,7 @@ def run_module(): + + + def syspatch_run(module): +- cmd = ['/usr/sbin/syspatch'] ++ cmd = module.get_bin_path('syspatch', True) + changed = False + reboot_needed = False + warnings = [] +@@ -116,7 +126,7 @@ def syspatch_run(module): + run_flag = [] + + # Run check command +- rc, out, err = module.run_command(cmd + check_flag) ++ rc, out, err = module.run_command([cmd] + check_flag) + + if rc != 0: + module.fail_json(msg="Command %s failed rc=%d, out=%s, err=%s" % (cmd, rc, out, err)) +@@ -131,21 +141,21 @@ def syspatch_run(module): + if module.check_mode: + changed = change_pending + elif change_pending: +- rc, out, err = module.run_command(cmd + run_flag) ++ rc, out, err = module.run_command([cmd] + run_flag) + + # Workaround syspatch ln bug: + # 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'): ++ elif out.lower().find('create unique kernel') > 0: + # Kernel update applied + reboot_needed = True +- elif out.lower().find('syspatch updated itself'): +- warnings.append['Syspatch was updated. Please run syspatch again.'] ++ elif out.lower().find('syspatch updated itself') > 0: ++ warnings.append('Syspatch was updated. Please run syspatch again.') + + # If no stdout, then warn user +- if len(out) > 0: +- warnings.append['syspatch had suggested changes, but stdout was empty.'] ++ if len(out) == 0: ++ warnings.append('syspatch had suggested changes, but stdout was empty.') + + changed = True + else: diff --git a/srcpkgs/ansible/patches/service-dragonfly.patch b/srcpkgs/ansible/patches/service-dragonfly.patch new file mode 100644 index 00000000000..3280ab9788f --- /dev/null +++ b/srcpkgs/ansible/patches/service-dragonfly.patch @@ -0,0 +1,29 @@ +--- a/lib/ansible/modules/system/service.py ++++ b/lib/ansible/modules/system/service.py +@@ -414,7 +414,7 @@ class Service(object): + + # Write out the contents of the list into our temporary file. + for rcline in new_rc_conf: +- os.write(TMP_RCCONF, rcline) ++ os.write(TMP_RCCONF, to_bytes(rcline)) + + # Close temporary file. + os.close(TMP_RCCONF) +@@ -1111,7 +1111,7 @@ class DragonFlyBsdService(FreeBsdService + if os.path.isfile(rcfile): + self.rcconf_file = rcfile + +- self.rcconf_key = "%s" % string.replace(self.name, "-", "_") ++ self.rcconf_key = "%s" % self.name.replace("-", "_") + + return self.service_enable_rcconf() + +@@ -1299,7 +1299,7 @@ class NetBsdService(Service): + if os.path.isfile(rcfile): + self.rcconf_file = rcfile + +- self.rcconf_key = "%s" % string.replace(self.name, "-", "_") ++ self.rcconf_key = "%s" % self.name.replace("-", "_") + + return self.service_enable_rcconf() + diff --git a/srcpkgs/ansible/template b/srcpkgs/ansible/template index f29aca6789b..6620dc836e2 100644 --- a/srcpkgs/ansible/template +++ b/srcpkgs/ansible/template @@ -1,10 +1,9 @@ # Template file for 'ansible' pkgname=ansible -version=2.9.3 +version=2.9.9 revision=1 archs=noarch build_style=python3-module -pycompile_module="ansible" hostmakedepends="python3-setuptools" depends="${hostmakedepends} python3-cryptography python3-Jinja2 python3-paramiko python3-yaml" @@ -14,7 +13,8 @@ maintainer="Michael Aldridge " license="GPL-3.0-or-later" homepage="https://www.ansible.com/" distfiles="https://releases.ansible.com/ansible/${pkgname}-${version}.tar.gz" -checksum=36f501a17fb15d210722b649d53582acf47835ea0bbda7eab79e13c945e4eac2 +checksum=e83d84ae8bf131c0499d8a4c0e1144bf969454c43086e61cca3c224227df29d1 +patch_args="-Np1" post_install() { vsconf examples/ansible.cfg