View | Details | Raw Unified | Return to bug 214322 | Differences between
and this patch

Collapse All | Expand All

(-)Makefile (+3 lines)
Lines 3-8 Link Here
3
3
4
PORTNAME=	ansible
4
PORTNAME=	ansible
5
PORTVERSION?=	2.2.0.0
5
PORTVERSION?=	2.2.0.0
6
PORTREVISION?=	1
6
CATEGORIES=	sysutils python
7
CATEGORIES=	sysutils python
7
MASTER_SITES=	http://releases.ansible.com/ansible/
8
MASTER_SITES=	http://releases.ansible.com/ansible/
8
9
Lines 17-22 Link Here
17
		${PYTHON_PKGNAMEPREFIX}paramiko>0:security/py-paramiko \
18
		${PYTHON_PKGNAMEPREFIX}paramiko>0:security/py-paramiko \
18
		${PYTHON_PKGNAMEPREFIX}Jinja2>0:devel/py-Jinja2
19
		${PYTHON_PKGNAMEPREFIX}Jinja2>0:devel/py-Jinja2
19
20
21
EXTRA_PATCHES=	${FILESDIR}/extra-patch-872594b
22
20
NO_ARCH=	yes
23
NO_ARCH=	yes
21
USES?=		cpe python shebangfix
24
USES?=		cpe python shebangfix
22
USE_PYTHON=	autoplist distutils
25
USE_PYTHON=	autoplist distutils
(-)files/extra-patch-872594b (+41 lines)
Line 0 Link Here
1
From 872594b49a69a1f3795e0de3f7cf0194b6bdfd53 Mon Sep 17 00:00:00 2001
2
From: Michael Scherer <misc@redhat.com>
3
Date: Sun, 23 Oct 2016 19:24:00 +0200
4
Subject: [PATCH] Make service work when the service is not present in rc.conf
5
6
After installing a package from the ports collection on a
7
fresh FreeBSD 11.0, Ansible was unable to enable it, failing with
8
"unable to get current rcvar value". Debugging showed that sysrc
9
didn't see the variable from /usr/local/etc/rc.d/myservice, but
10
adding the value was working.
11
12
So we will just fallback to the default value if we can't find it.
13
---
14
 system/service.py | 6 ++++--
15
 1 file changed, 4 insertions(+), 2 deletions(-)
16
17
diff --git system/service.py system/service.py
18
index d216e68..c8781b1 100644
19
--- lib/ansible/modules/core/system/service.py
20
+++ lib/ansible/modules/core/system/service.py
21
@@ -988,7 +988,7 @@ def service_enable(self):
22
         # and hope for the best.
23
         for rcvar in rcvars:
24
             if '=' in rcvar:
25
-                self.rcconf_key = rcvar.split('=')[0]
26
+                self.rcconf_key, default_rcconf_value = rcvar.split('=', 1)
27
                 break
28
 
29
         if self.rcconf_key is None:
30
@@ -997,8 +997,10 @@ def service_enable(self):
31
         if self.sysrc_cmd: # FreeBSD >= 9.2
32
 
33
             rc, current_rcconf_value, stderr = self.execute_command("%s -n %s" % (self.sysrc_cmd, self.rcconf_key))
34
+            # it can happen that rcvar is not set (case of a system coming from the ports collection)
35
+            # so we will fallback on the default
36
             if rc != 0:
37
-                self.module.fail_json(msg="unable to get current rcvar value", stdout=stdout, stderr=stderr)
38
+                current_rcconf_value = default_rcconf_value
39
 
40
             if current_rcconf_value.strip().upper() != self.rcconf_value:
41
 

Return to bug 214322