Update to ansible-2.7.1

Similar diff from Edward Lopez-Acosta, ok jasper@ (maintainer)
This commit is contained in:
danj 2018-11-14 12:18:40 +00:00
parent aa81e92d88
commit f5d0bf79d7
4 changed files with 12 additions and 91 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.95 2018/10/19 11:46:42 danj Exp $
# $OpenBSD: Makefile,v 1.96 2018/11/14 12:18:40 danj Exp $
COMMENT-main = ssh based config management framework
COMMENT-html = offline Ansible documentation in HTML format
MODPY_EGG_VERSION = 2.7.0
MODPY_EGG_VERSION = 2.7.1
DISTNAME = ansible-${MODPY_EGG_VERSION}
PKGNAME-main = ${PKGNAME}
PKGNAME-html = ansible-html-${MODPY_EGG_VERSION}
@ -56,8 +56,9 @@ post-build:
${WRKSRC}/docs/docsite/_build/html/_static/css/theme.min.css
post-install:
${INSTALL_DATA_DIR} ${EXDIR} ${DOCDIR}
${INSTALL_DATA} ${WRKSRC}/examples/* ${EXDIR}
${INSTALL_DATA_DIR} ${EXDIR}/scripts ${DOCDIR}
${INSTALL_DATA} ${WRKSRC}/examples/scripts/* ${EXDIR}/scripts/
${INSTALL_DATA} ${WRKSRC}/examples/{ansible.cfg,hosts} ${EXDIR}
${SUBST_CMD} ${EXDIR}/hosts
${INSTALL_DATA} ${WRKSRC}/docs/man/man1/*.1 ${PREFIX}/man/man1
cp -R ${WRKBUILD}/docs/docsite/_build/html ${DOCDIR}

View File

@ -1,2 +1,2 @@
SHA256 (ansible-2.7.0.tar.gz) = oauODxPnmiBmGtZUb0WhQq/q62ZN6ywpDjI2LYrlthg=
SIZE (ansible-2.7.0.tar.gz) = 11773769
SHA256 (ansible-2.7.1.tar.gz) = 55U0cjR/zG3KEIOREbV2qfeQ4ABWNE8tz0SObEUv6Tk=
SIZE (ansible-2.7.1.tar.gz) = 11738557

View File

@ -1,84 +0,0 @@
$OpenBSD: patch-lib_ansible_plugins_action_reboot_py,v 1.1 2018/10/19 11:46:42 danj Exp $
Backport until 2.7.1
https://github.com/ansible/ansible/commit/26de4f97493adeb388c1c8fad7a266bb7652bac6
https://github.com/ansible/ansible/commit/a0f38bdab5ae0e183cb960fe9e964bf1edf7c326
Index: lib/ansible/plugins/action/reboot.py
--- lib/ansible/plugins/action/reboot.py.orig
+++ lib/ansible/plugins/action/reboot.py
@@ -28,7 +28,7 @@ class TimedOutException(Exception):
class ActionModule(ActionBase):
TRANSFERS_FILES = False
- _VALID_ARGS = frozenset(('connect_timeout', 'msg', 'post_reboot_delay', 'pre_reboot_delay', 'test_command'))
+ _VALID_ARGS = frozenset(('connect_timeout', 'msg', 'post_reboot_delay', 'pre_reboot_delay', 'test_command', 'reboot_timeout'))
DEFAULT_REBOOT_TIMEOUT = 600
DEFAULT_CONNECT_TIMEOUT = None
@@ -42,18 +42,24 @@ class ActionModule(ActionBase):
DEPRECATED_ARGS = {}
+ BOOT_TIME_COMMANDS = {
+ 'openbsd': "/sbin/sysctl kern.boottime",
+ }
+
SHUTDOWN_COMMANDS = {
'linux': DEFAULT_SHUTDOWN_COMMAND,
'freebsd': DEFAULT_SHUTDOWN_COMMAND,
'sunos': '/usr/sbin/shutdown',
'darwin': '/sbin/shutdown',
+ 'openbsd': DEFAULT_SHUTDOWN_COMMAND,
}
SHUTDOWN_COMMAND_ARGS = {
'linux': '-r {delay_min} "{message}"',
'freebsd': '-r +{delay_sec}s "{message}"',
'sunos': '-y -g {delay_sec} -r "{message}"',
- 'darwin': '-r +{delay_min_macos} "{message}"'
+ 'darwin': '-r +{delay_min_macos} "{message}"',
+ 'openbsd': '-r +{delay_min} "{message}"',
}
def __init__(self, *args, **kwargs):
@@ -94,18 +100,37 @@ class ActionModule(ActionBase):
return reboot_command
def get_system_boot_time(self):
- command_result = self._low_level_execute_command(self.DEFAULT_BOOT_TIME_COMMAND, sudoable=self.DEFAULT_SUDOABLE)
+ stdout = u''
+ stderr = u''
+ # Determine the system distribution in order to use the correct shutdown command arguments
+ uname_result = self._low_level_execute_command('uname')
+ distribution = uname_result['stdout'].strip().lower()
+
+ boot_time_command = self.BOOT_TIME_COMMANDS.get(distribution, self.DEFAULT_BOOT_TIME_COMMAND)
+ command_result = self._low_level_execute_command(boot_time_command, sudoable=self.DEFAULT_SUDOABLE)
+
# For single board computers, e.g., Raspberry Pi, that lack a real time clock and are using fake-hwclock
# launched by systemd, the update of utmp/wtmp is not done correctly.
# Fall back to using uptime -s for those systems.
# https://github.com/systemd/systemd/issues/6057
if '1970-01-01 00:00' in command_result['stdout']:
+ stdout += command_result['stdout']
+ stderr += command_result['stderr']
command_result = self._low_level_execute_command('uptime -s', sudoable=self.DEFAULT_SUDOABLE)
+ # This is a last resort for bare Linux systems (e.g. OpenELEC) where 'who -b' or 'uptime -s' are not supported.
+ # Other options like parsing /proc/uptime or default uptime output are less reliable than this
if command_result['rc'] != 0:
+ stdout += command_result['stdout']
+ stderr += command_result['stderr']
+ command_result = self._low_level_execute_command('cat /proc/sys/kernel/random/boot_id', sudoable=self.DEFAULT_SUDOABLE)
+
+ if command_result['rc'] != 0:
+ stdout += command_result['stdout']
+ stderr += command_result['stderr']
raise AnsibleError("%s: failed to get host boot time info, rc: %d, stdout: %s, stderr: %s"
- % (self._task.action, command_result.rc, to_native(command_result['stdout']), to_native(command_result['stderr'])))
+ % (self._task.action, command_result['rc'], to_native(stdout), to_native(stderr)))
return command_result['stdout'].strip()

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST-main,v 1.9 2018/10/19 11:46:42 danj Exp $
@comment $OpenBSD: PLIST-main,v 1.10 2018/11/14 12:18:40 danj Exp $
@pkgpath sysutils/ansible
bin/ansible
bin/ansible-config
@ -6729,6 +6729,7 @@ share/doc/ansible/html/dev_guide/developing_locally.html
share/doc/ansible/html/dev_guide/developing_modules_general_aci.html
share/doc/ansible/html/dev_guide/module_lifecycle.html
share/doc/ansible/html/dev_guide/testing/sanity/changelog.html
share/doc/ansible/html/dev_guide/testing/sanity/symlinks.html
share/doc/ansible/html/dev_guide/testing_documentation.html
share/doc/ansible/html/network/user_guide/platform_cnos.html
share/doc/ansible/html/network/user_guide/platform_enos.html
@ -6772,3 +6773,6 @@ share/examples/ansible/ansible.cfg
@sample ${SYSCONFDIR}/ansible/ansible.cfg
share/examples/ansible/hosts
@sample ${SYSCONFDIR}/ansible/hosts
share/examples/ansible/scripts/
share/examples/ansible/scripts/ConfigureRemotingForAnsible.ps1
share/examples/ansible/scripts/upgrade_to_ps3.ps1