svn commit: r425744 - in head/sysutils/ansible: . files
Matthew Seaman
matthew at FreeBSD.org
Tue Nov 8 14:17:31 UTC 2016
Author: matthew
Date: Tue Nov 8 14:17:30 2016
New Revision: 425744
URL: https://svnweb.freebsd.org/changeset/ports/425744
Log:
Backport patch 872594b from upstream
This is a FreeBSD specific fix to the handling of rcvars -- this fixes
the case where the rcvar did not previously exist in /etc/rc.conf or
other places the rc system might look for them.
https://github.com/ansible/ansible-modules-core/commit/872594b49a69a1f3795e0de3f7cf0194b6bdfd53
PR: 214322
Reported by: Thomas Steen Rasmussen
Approved by: lifanov at mail.lifanov.com (maintainer)
Added:
head/sysutils/ansible/files/extra-patch-872594b (contents, props changed)
Modified:
head/sysutils/ansible/Makefile
Modified: head/sysutils/ansible/Makefile
==============================================================================
--- head/sysutils/ansible/Makefile Tue Nov 8 14:10:55 2016 (r425743)
+++ head/sysutils/ansible/Makefile Tue Nov 8 14:17:30 2016 (r425744)
@@ -3,6 +3,7 @@
PORTNAME= ansible
PORTVERSION?= 2.2.0.0
+PORTREVISION?= 1
CATEGORIES= sysutils python
MASTER_SITES= http://releases.ansible.com/ansible/
@@ -17,6 +18,8 @@ RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}yaml
${PYTHON_PKGNAMEPREFIX}paramiko>0:security/py-paramiko \
${PYTHON_PKGNAMEPREFIX}Jinja2>0:devel/py-Jinja2
+EXTRA_PATCHES?= ${FILESDIR}/extra-patch-872594b
+
NO_ARCH= yes
USES?= cpe python shebangfix
USE_PYTHON= autoplist distutils
Added: head/sysutils/ansible/files/extra-patch-872594b
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/sysutils/ansible/files/extra-patch-872594b Tue Nov 8 14:17:30 2016 (r425744)
@@ -0,0 +1,41 @@
+From 872594b49a69a1f3795e0de3f7cf0194b6bdfd53 Mon Sep 17 00:00:00 2001
+From: Michael Scherer <misc at redhat.com>
+Date: Sun, 23 Oct 2016 19:24:00 +0200
+Subject: [PATCH] Make service work when the service is not present in rc.conf
+
+After installing a package from the ports collection on a
+fresh FreeBSD 11.0, Ansible was unable to enable it, failing with
+"unable to get current rcvar value". Debugging showed that sysrc
+didn't see the variable from /usr/local/etc/rc.d/myservice, but
+adding the value was working.
+
+So we will just fallback to the default value if we can't find it.
+---
+ system/service.py | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git system/service.py system/service.py
+index d216e68..c8781b1 100644
+--- lib/ansible/modules/core/system/service.py
++++ lib/ansible/modules/core/system/service.py
+@@ -988,7 +988,7 @@ def service_enable(self):
+ # and hope for the best.
+ for rcvar in rcvars:
+ if '=' in rcvar:
+- self.rcconf_key = rcvar.split('=')[0]
++ self.rcconf_key, default_rcconf_value = rcvar.split('=', 1)
+ break
+
+ if self.rcconf_key is None:
+@@ -997,8 +997,10 @@ def service_enable(self):
+ if self.sysrc_cmd: # FreeBSD >= 9.2
+
+ rc, current_rcconf_value, stderr = self.execute_command("%s -n %s" % (self.sysrc_cmd, self.rcconf_key))
++ # it can happen that rcvar is not set (case of a system coming from the ports collection)
++ # so we will fallback on the default
+ if rc != 0:
+- self.module.fail_json(msg="unable to get current rcvar value", stdout=stdout, stderr=stderr)
++ current_rcconf_value = default_rcconf_value
+
+ if current_rcconf_value.strip().upper() != self.rcconf_value:
+
More information about the svn-ports-head
mailing list