diff options
author | lifanov <lifanov@FreeBSD.org> | 2018-05-04 01:02:07 +0800 |
---|---|---|
committer | lifanov <lifanov@FreeBSD.org> | 2018-05-04 01:02:07 +0800 |
commit | 51d6f8637dddeb480f0d46f2c667d5df37d5d898 (patch) | |
tree | b485f8f15b317d9c71cf16300ca8a096f09714c7 /sysutils | |
parent | 9051253aa73050fb0a656c7cea0ce4e1d9ad9473 (diff) | |
download | freebsd-ports-gnome-51d6f8637dddeb480f0d46f2c667d5df37d5d898.tar.gz freebsd-ports-gnome-51d6f8637dddeb480f0d46f2c667d5df37d5d898.tar.zst freebsd-ports-gnome-51d6f8637dddeb480f0d46f2c667d5df37d5d898.zip |
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
Diffstat (limited to 'sysutils')
-rw-r--r-- | sysutils/ansible/Makefile | 4 | ||||
-rw-r--r-- | sysutils/ansible/files/extra-patch-sesu | 73 |
2 files changed, 75 insertions, 2 deletions
diff --git a/sysutils/ansible/Makefile b/sysutils/ansible/Makefile index d3494ae95636..b475badde32e 100644 --- a/sysutils/ansible/Makefile +++ b/sysutils/ansible/Makefile @@ -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-Jinja2@${PY_FLAVOR} \ CONFLICTS?= ansible1-* ansible23-* ansible24-* -EXTRA_PATCHES?= # +EXTRA_PATCHES?= ${FILESDIR}/extra-patch-sesu NO_ARCH= yes USES?= cpe python diff --git a/sysutils/ansible/files/extra-patch-sesu b/sysutils/ansible/files/extra-patch-sesu new file mode 100644 index 000000000000..194f19137d6d --- /dev/null +++ b/sysutils/ansible/files/extra-patch-sesu @@ -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) |