Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 May 2018 17:02:07 +0000 (UTC)
From:      Nikolai Lifanov <lifanov@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r468946 - in head/sysutils/ansible: . files
Message-ID:  <201805031702.w43H272d089009@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: lifanov
Date: Thu May  3 17:02:07 2018
New Revision: 468946
URL: https://svnweb.freebsd.org/changeset/ports/468946

Log:
  sysutils/ansible: add 'sesu' become method
  
  This adds CA sesu as a "become" method.
  
  Pull request: https://github.com/ansible/ansible/pull/27376
  
  PR:		227934
  Submitted by:	mi

Added:
  head/sysutils/ansible/files/extra-patch-sesu   (contents, props changed)
Modified:
  head/sysutils/ansible/Makefile

Modified: head/sysutils/ansible/Makefile
==============================================================================
--- head/sysutils/ansible/Makefile	Thu May  3 17:00:50 2018	(r468945)
+++ head/sysutils/ansible/Makefile	Thu May  3 17:02:07 2018	(r468946)
@@ -2,7 +2,7 @@
 
 PORTNAME=	ansible
 PORTVERSION?=	2.5.2
-PORTREVISION?=	0
+PORTREVISION?=	1
 CATEGORIES=	sysutils python
 MASTER_SITES=	http://releases.ansible.com/ansible/
 
@@ -21,7 +21,7 @@ RUN_DEPENDS?=	${PYTHON_PKGNAMEPREFIX}Jinja2>0:devel/py
 
 CONFLICTS?=	ansible1-* ansible23-* ansible24-*
 
-EXTRA_PATCHES?=	#
+EXTRA_PATCHES?=	${FILESDIR}/extra-patch-sesu
 
 NO_ARCH=	yes
 USES?=		cpe python

Added: head/sysutils/ansible/files/extra-patch-sesu
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/ansible/files/extra-patch-sesu	Thu May  3 17:02:07 2018	(r468946)
@@ -0,0 +1,73 @@
+See:
+
+	https://github.com/ansible/ansible/pull/27376
+
+--- lib/ansible/constants.py
++++ lib/ansible/constants.py
+@@ -60,6 +60,19 @@
+ 
+ # CONSTANTS ### yes, actual ones
+-BECOME_METHODS = ['sudo', 'su', 'pbrun', 'pfexec', 'doas', 'dzdo', 'ksu', 'runas', 'pmrun', 'enable']
++BECOME_METHODS = [
++    'sesu',
++    'sudo',
++    'su',
++    'pbrun',
++    'pfexec',
++    'doas',
++    'dzdo',
++    'ksu',
++    'runas',
++    'pmrun',
++    'enable'
++]
+ BECOME_ERROR_STRINGS = {
++    'sesu': '',
+     'sudo': 'Sorry, try again.',
+     'su': 'Authentication failure',
+@@ -73,4 +85,5 @@
+ }  # FIXME: deal with i18n
+ BECOME_MISSING_STRINGS = {
++    'sesu': '',
+     'sudo': 'sorry, a password is required to run sudo',
+     'su': '',
+--- lib/ansible/modules/commands/command.py
++++ lib/ansible/modules/commands/command.py
+@@ -105,7 +105,7 @@
+                 'mount': 'mount', 'rpm': 'yum, dnf or zypper', 'yum': 'yum', 'apt-get': 'apt',
+                 'tar': 'unarchive', 'unzip': 'unarchive', 'sed': 'template or lineinfile',
+                 'dnf': 'dnf', 'zypper': 'zypper'}
+-    become = ['sudo', 'su', 'pbrun', 'pfexec', 'runas', 'pmrun']
++    become = ['sudo', 'su', 'pbrun', 'pfexec', 'runas', 'pmrun', 'sesu']
+     command = os.path.basename(commandline.split()[0])
+     if command in arguments:
+         module.warn("Consider using file module with %s rather than running %s" % (arguments[command], command))
+--- lib/ansible/modules/web_infrastructure/ansible_tower/tower_credential.py
++++ lib/ansible/modules/web_infrastructure/ansible_tower/tower_credential.py
+@@ -123,9 +123,9 @@
+       default: null
+     become_method:
+       description:
+-        - Become method to Use for privledge escalation.
++        - Become method to Use for privilege escalation.
+       required: False
+-      choices: ["None", "sudo", "su", "pbrun", "pfexec", "pmrun"]
++      choices: ["None", "sudo", "su", "pbrun", "pfexec", "pmrun", "sesu"]
+       default: "None"
+     become_username:
+       description:
+--- lib/ansible/playbook/play_context.py
++++ lib/ansible/playbook/play_context.py
+@@ -599,6 +599,13 @@ def detect_ksu_prompt(b_data):
+                 prompt = 'Enter UPM user password:'
+                 becomecmd = '%s %s %s' % (exe, flags, shlex_quote(command))
+ 
++            elif self.become_method == 'sesu':
++
++                exe = self.become_exe or 'sesu'
++
++                prompt = 'Please enter your password:'
++                becomecmd = '%s %s %s -c %s' % (exe, flags, self.become_user, shlex_quote(command))
++
+             else:
+                 raise AnsibleError("Privilege escalation method not found: %s" % self.become_method)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805031702.w43H272d089009>