From owner-svn-ports-head@freebsd.org Tue Nov 8 14:17:31 2016 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB072C373BA; Tue, 8 Nov 2016 14:17:31 +0000 (UTC) (envelope-from matthew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 82AEEDDB; Tue, 8 Nov 2016 14:17:31 +0000 (UTC) (envelope-from matthew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA8EHUf2038365; Tue, 8 Nov 2016 14:17:30 GMT (envelope-from matthew@FreeBSD.org) Received: (from matthew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA8EHUAB038363; Tue, 8 Nov 2016 14:17:30 GMT (envelope-from matthew@FreeBSD.org) Message-Id: <201611081417.uA8EHUAB038363@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: matthew set sender to matthew@FreeBSD.org using -f From: Matthew Seaman Date: Tue, 8 Nov 2016 14:17:30 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r425744 - in head/sysutils/ansible: . files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 14:17:31 -0000 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@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 +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: +