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

Collapse All | Expand All

(-)sysutils/ansible29/Makefile (+127 lines)
Line 0 Link Here
1
# $FreeBSD$
2
3
PORTNAME=	ansible
4
PORTVERSION?=	2.9.14
5
PORTREVISION?=	0
6
CATEGORIES=	sysutils python
7
MASTER_SITES=	http://releases.ansible.com/ansible/
8
PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
9
PKGNAMESUFFIX?=	29
10
11
MAINTAINER=	lifanov@FreeBSD.org
12
COMMENT=	Radically simple IT automation
13
14
LICENSE=	GPLv3+
15
LICENSE_FILE=	${WRKSRC}/COPYING
16
17
RUN_DEPENDS?=	${PYTHON_PKGNAMEPREFIX}Jinja2>0:devel/py-Jinja2@${PY_FLAVOR} \
18
		${PYTHON_PKGNAMEPREFIX}cryptography>0:security/py-cryptography@${PY_FLAVOR} \
19
		${PYTHON_PKGNAMEPREFIX}jmespath>0:devel/py-jmespath@${PY_FLAVOR} \
20
		${PYTHON_PKGNAMEPREFIX}netaddr>0:net/py-netaddr@${PY_FLAVOR} \
21
		${PYTHON_PKGNAMEPREFIX}paramiko>0:security/py-paramiko@${PY_FLAVOR} \
22
		${PYTHON_PKGNAMEPREFIX}yaml>0:devel/py-yaml@${PY_FLAVOR}
23
TEST_DEPENDS?=	${PYTHON_PKGNAMEPREFIX}pytest>0:devel/py-pytest@${PY_FLAVOR} \
24
		${PYTHON_PKGNAMEPREFIX}pytest-xdist>0:devel/py-pytest-xdist@${PY_FLAVOR} \
25
		${PYTHON_PKGNAMEPREFIX}pytest-mock>0:devel/py-pytest-mock@${PY_FLAVOR} \
26
		${PYTHON_PKGNAMEPREFIX}requests>0:www/py-requests@${PY_FLAVOR} \
27
		${PYTHON_PKGNAMEPREFIX}passlib>0:security/py-passlib@${PY_FLAVOR} \
28
		${PYTHON_PKGNAMEPREFIX}boto3>0:www/py-boto3@${PY_FLAVOR} \
29
		${PYTHON_PKGNAMEPREFIX}mock>0:devel/py-mock@${PY_FLAVOR} \
30
		${PYTHON_PKGNAMEPREFIX}nose>0:devel/py-nose@${PY_FLAVOR}
31
32
USES?=		cpe python shebangfix
33
USE_PYTHON=	distutils autoplist concurrent
34
35
OPTIONS_DEFINE=	DOCS EXAMPLES
36
37
NO_ARCH=	yes
38
CPE_VENDOR=	ansibleworks
39
40
CONFLICTS?=	*ansible-2* \
41
		*ansible1-* \
42
		*ansible23-* \
43
		*ansible24-* \
44
		*ansible25-* \
45
		*ansible27-* \
46
		*ansible26-* \
47
		*ansible27-* \
48
		*ansible28-*
49
50
EXTRA_PATCHES?=
51
52
SHEBANG_FILES?=	\
53
		test/lib/ansible_test/_data/injector/python.py \
54
		test/lib/ansible_test/_data/versions.py \
55
		test/lib/ansible_test/_data/virtualenvcheck.py \
56
		test/lib/ansible_test/_data/yamlcheck.py \
57
		test/lib/ansible_test/_data/cli/ansible_test_cli_stub.py \
58
		test/lib/ansible_test/_data/sanity/import/importer.py \
59
		test/lib/ansible_test/_data/sanity/code-smell/metaclass-boilerplate.py \
60
		test/lib/ansible_test/_data/sanity/code-smell/future-import-boilerplate.py \
61
		test/lib/ansible_test/_data/sanity/code-smell/use-argspec-type-path.py \
62
		test/lib/ansible_test/_data/sanity/code-smell/no-get-exception.py \
63
		test/lib/ansible_test/_data/sanity/code-smell/no-illegal-filenames.py \
64
		test/lib/ansible_test/_data/sanity/code-smell/no-dict-iterkeys.py \
65
		test/lib/ansible_test/_data/sanity/code-smell/no-smart-quotes.py \
66
		test/lib/ansible_test/_data/sanity/code-smell/replace-urlopen.py \
67
		test/lib/ansible_test/_data/sanity/code-smell/no-unicode-literals.py \
68
		test/lib/ansible_test/_data/sanity/code-smell/action-plugin-docs.py \
69
		test/lib/ansible_test/_data/sanity/code-smell/no-main-display.py \
70
		test/lib/ansible_test/_data/sanity/code-smell/no-dict-itervalues.py \
71
		test/lib/ansible_test/_data/sanity/code-smell/no-dict-iteritems.py \
72
		test/lib/ansible_test/_data/sanity/code-smell/no-assert.py \
73
		test/lib/ansible_test/_data/sanity/code-smell/use-compat-six.py \
74
		test/lib/ansible_test/_data/sanity/code-smell/line-endings.py \
75
		test/lib/ansible_test/_data/sanity/code-smell/symlinks.py \
76
		test/lib/ansible_test/_data/sanity/code-smell/shebang.py \
77
		test/lib/ansible_test/_data/sanity/code-smell/empty-init.py \
78
		test/lib/ansible_test/_data/sanity/code-smell/no-basestring.py \
79
		test/lib/ansible_test/_data/sanity/yamllint/yamllinter.py \
80
		test/lib/ansible_test/_data/sanity/compile/compile.py \
81
		test/lib/ansible_test/_data/sanity/validate-modules/main.py
82
83
SUB_FILES=	pkg-message
84
SUB_LIST+=	PYTHON_CMD=${PYTHON_CMD}
85
86
PLIST_FILES?=	man/man1/ansible-config.1.gz \
87
		man/man1/ansible-console.1.gz \
88
		man/man1/ansible-doc.1.gz \
89
		man/man1/ansible-galaxy.1.gz \
90
		man/man1/ansible-inventory.1.gz \
91
		man/man1/ansible-playbook.1.gz \
92
		man/man1/ansible-pull.1.gz \
93
		man/man1/ansible-vault.1.gz \
94
		man/man1/ansible.1.gz
95
96
PORTEXAMPLES=	ansible.cfg hosts
97
98
post-patch:
99
	${FIND} ${WRKSRC} -type f -print0 | ${XARGS} -0 ${REINPLACE_CMD} \
100
		-e 's|/etc/ansible|${ETCDIR:S/${PY_FLAVOR}-//}|g' \
101
		-e 's|/usr/share/ansible|${DATADIR}|g'
102
	${FIND} ${WRKSRC} -type f -name "*.bak" -delete
103
104
post-install:
105
	@${MKDIR} ${STAGEDIR}${MAN1PREFIX}/man/man1
106
	${INSTALL_MAN} ${WRKSRC}/docs/man/man1/*.1 \
107
		${STAGEDIR}${MAN1PREFIX}/man/man1
108
109
post-install-EXAMPLES-on:
110
	@${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
111
	${INSTALL_DATA} ${WRKSRC}/examples/ansible.cfg ${STAGEDIR}${EXAMPLESDIR}
112
	${INSTALL_DATA} ${WRKSRC}/examples/hosts ${STAGEDIR}${EXAMPLESDIR}
113
114
post-stage:
115
	${FIND} ${STAGEDIR}${PREFIX}/bin -type l -name ansible-\* -lname ansible \
116
		-execdir ${RLN} ansible-${PYTHON_VER} {} \;
117
	# python autoplist doesn't add this file in plist
118
	${RM} ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/ansible_test/_data/injector/ansible-inventory
119
120
# TEST_WRKSRC=${WRKSRC}/test
121
#
122
#do-test:
123
#	${PYTHON_CMD} ${TEST_WRKSRC}/runner/ansible-test sanity --python ${PYTHON_VER} -v
124
#	${RM} ${TEST_WRKSRC}/units/modules/net_tools/test_nmcli.py # not conditional/doesn't work with nose
125
#	${PYTHON_CMD} ${TEST_WRKSRC}/runner/ansible-test units --python ${PYTHON_VER} -v
126
127
.include <bsd.port.mk>
(-)sysutils/ansible29/distinfo (+3 lines)
Line 0 Link Here
1
TIMESTAMP = 1603206359
2
SHA256 (ansible-2.9.14.tar.gz) = efe7183e08f0c9dd9efd9124efa8978be62851b1e8eb856593a073538bfc6fb5
3
SIZE (ansible-2.9.14.tar.gz) = 14272261
(-)sysutils/ansible29/files/extra-patch-27 (+84 lines)
Line 0 Link Here
1
--- lib/ansible/module_utils/facts/virtual/freebsd.py.orig	2020-04-17 14:07:09 UTC
2
+++ lib/ansible/module_utils/facts/virtual/freebsd.py
3
@@ -19,9 +19,11 @@ __metaclass__ = type
4
 import os
5
 
6
 from ansible.module_utils.facts.virtual.base import Virtual, VirtualCollector
7
+# Rudimentary detection of the virtual platforms, more through version is coming. Catches VMWare at minimum.
8
+from ansible.module_utils.facts.virtual.sysctl import VirtualSysctlDetectionMixin
9
 
10
 
11
-class FreeBSDVirtual(Virtual):
12
+class FreeBSDVirtual(Virtual, VirtualSysctlDetectionMixin):
13
     """
14
     This is a FreeBSD-specific subclass of Virtual.  It defines
15
     - virtualization_type
16
@@ -34,6 +36,9 @@ class FreeBSDVirtual(Virtual):
17
         # Set empty values as default
18
         virtual_facts['virtualization_type'] = ''
19
         virtual_facts['virtualization_role'] = ''
20
+
21
+        virtual_product_facts = self.detect_virt_product('hw.hv_vendor')
22
+        virtual_facts.update(virtual_product_facts)
23
 
24
         if os.path.exists('/dev/xen/xenstore'):
25
             virtual_facts['virtualization_type'] = 'xen'
26
--- lib/ansible/modules/packaging/os/pkgng.py.orig	2020-04-17 14:07:10 UTC
27
+++ lib/ansible/modules/packaging/os/pkgng.py
28
@@ -201,13 +201,17 @@ def install_packages(module, pkgng_path, packages, cac
29
 
30
     # This environment variable skips mid-install prompts,
31
     # setting them to their default values.
32
-    batch_var = 'env BATCH=yes'
33
+    # There is at least one case, when upgrading from 11.1 to 11.2 when pkg asks extra 
34
+    # question about OS version mismatch in the repository. As this isn't handled, playbook
35
+    # hangs forever. Adding ASSUME_ALWAYS_YES to the environment addresses that, and
36
+    # possibly other potential issues.
37
+    batch_var = 'env BATCH=yes ASSUME_ALWAYS_YES=yes'
38
 
39
     if not module.check_mode and not cached:
40
         if old_pkgng:
41
-            rc, out, err = module.run_command("%s %s update" % (pkgsite, pkgng_path))
42
+            rc, out, err = module.run_command("%s %s %s update" % (batch_var, pkgsite, pkgng_path))
43
         else:
44
-            rc, out, err = module.run_command("%s %s update" % (pkgng_path, dir_arg))
45
+            rc, out, err = module.run_command("%s %s %s update" % (batch_var, pkgng_path, dir_arg))
46
         if rc != 0:
47
             module.fail_json(msg="Could not update catalogue")
48
 
49
--- lib/ansible/modules/storage/zfs/zfs.py.orig	2020-04-17 14:07:11 UTC
50
+++ lib/ansible/modules/storage/zfs/zfs.py
51
@@ -102,7 +102,15 @@ class Zfs(object):
52
         self.changed = False
53
         self.zfs_cmd = module.get_bin_path('zfs', True)
54
         self.zpool_cmd = module.get_bin_path('zpool', True)
55
-        self.pool = name.split('/')[0]
56
+        # - name: Create a new file system by cloning a snapshot
57
+        # zfs:
58
+        #   name: rpool/cloned_fs
59
+        #   state: present
60
+        #   origin: rpool@mysnapshot
61
+        #
62
+        # doesn't work properly, as code assumes that there is at least one level of hierarchy
63
+        # in zpool. But that's not always the case - pool may be dataset as well and have a snapshot.
64
+        self.pool = name.split('@')[0].split('/')[0]
65
         self.is_solaris = os.uname()[0] == 'SunOS'
66
         self.is_openzfs = self.check_openzfs()
67
         self.enhanced_sharing = self.check_enhanced_sharing()
68
--- lib/ansible/playbook/play_context.py.orig	2020-04-17 14:07:10 UTC
69
+++ lib/ansible/playbook/play_context.py
70
@@ -528,8 +528,13 @@ class PlayContext(Base):
71
                 becomecmd = cmd
72
 
73
             elif self.become_method == 'doas':
74
+                # `doas` support in ansible is broken ATM, doesn't handle password
75
+                # authentication properly, cause assumes only challenge-respond auth.
76
+                # This patch should handle both ways properly.
77
+                def detect_doas_prompt(b_data):
78
+                    return re.match(b"[Pp]assword:", b_data)
79
 
80
-                prompt = 'doas (%s@' % self.remote_user
81
+                prompt = detect_doas_prompt
82
                 exe = self.become_exe or 'doas'
83
 
84
                 if not self.become_pass:
(-)sysutils/ansible29/files/extra-patch-sesu (+59 lines)
Line 0 Link Here
1
--- lib/ansible/constants.py.orig	2018-06-28 23:30:34 UTC
2
+++ lib/ansible/constants.py
3
@@ -59,8 +59,9 @@ def set_constant(name, value, export=var
4
 
5
 
6
 # CONSTANTS ### yes, actual ones
7
-BECOME_METHODS = ['sudo', 'su', 'pbrun', 'pfexec', 'doas', 'dzdo', 'ksu', 'runas', 'pmrun', 'enable', 'machinectl']
8
+BECOME_METHODS = ['sesu', 'sudo', 'su', 'pbrun', 'pfexec', 'doas', 'dzdo', 'ksu', 'runas', 'pmrun', 'enable', 'machinectl']
9
 BECOME_ERROR_STRINGS = {
10
+    'sesu': '',
11
     'sudo': 'Sorry, try again.',
12
     'su': 'Authentication failure',
13
     'pbrun': '',
14
@@ -73,6 +74,7 @@ BECOME_ERROR_STRINGS = {
15
     'machinectl': '',
16
 }  # FIXME: deal with i18n
17
 BECOME_MISSING_STRINGS = {
18
+    'sesu': '',
19
     'sudo': 'sorry, a password is required to run sudo',
20
     'su': '',
21
     'pbrun': '',
22
--- lib/ansible/modules/commands/command.py.orig	2018-06-28 23:30:34 UTC
23
+++ lib/ansible/modules/commands/command.py
24
@@ -142,7 +142,7 @@ def check_command(module, commandline):
25
                 'mount': 'mount', 'rpm': 'yum, dnf or zypper', 'yum': 'yum', 'apt-get': 'apt',
26
                 'tar': 'unarchive', 'unzip': 'unarchive', 'sed': 'replace, lineinfile or template',
27
                 'dnf': 'dnf', 'zypper': 'zypper'}
28
-    become = ['sudo', 'su', 'pbrun', 'pfexec', 'runas', 'pmrun', 'machinectl']
29
+    become = ['sesu', 'sudo', 'su', 'pbrun', 'pfexec', 'runas', 'pmrun', 'machinectl']
30
     if isinstance(commandline, list):
31
         command = commandline[0]
32
     else:
33
--- lib/ansible/modules/web_infrastructure/ansible_tower/tower_credential.py.orig	2018-06-28 23:30:34 UTC
34
+++ lib/ansible/modules/web_infrastructure/ansible_tower/tower_credential.py
35
@@ -96,7 +96,7 @@ options:
36
     become_method:
37
       description:
38
         - Become method to Use for privledge escalation.
39
-      choices: ["None", "sudo", "su", "pbrun", "pfexec", "pmrun"]
40
+      choices: ["None", "sesu", "sudo", "su", "pbrun", "pfexec", "pmrun"]
41
     become_username:
42
       description:
43
         - Become username. Use ASK for prompting.
44
--- lib/ansible/playbook/play_context.py.orig	2018-06-28 23:30:34 UTC
45
+++ lib/ansible/playbook/play_context.py
46
@@ -562,6 +562,13 @@ class PlayContext(Base):
47
                 exe = self.become_exe or 'machinectl'
48
                 becomecmd = '%s shell -q %s %s@ %s' % (exe, flags, self.become_user, command)
49
 
50
+            elif self.become_method == 'sesu':
51
+
52
+                exe = self.become_exe or 'sesu'
53
+
54
+                prompt = 'Please enter your password:'
55
+                becomecmd = '%s %s %s -c %s' % (exe, flags, self.become_user, shlex_quote(command))
56
+
57
             else:
58
                 raise AnsibleError("Privilege escalation method not found: %s" % self.become_method)
59
 
(-)sysutils/ansible29/files/pkg-message.in (+30 lines)
Line 0 Link Here
1
[
2
{
3
message: <<EOD
4
To use Ansible, you need at least a host database.
5
If you installed examples, you will have a sample
6
host database and a sample configuration file:
7
8
  %%EXAMPLESDIR%%/hosts
9
  %%EXAMPLESDIR%%/ansible.cfg
10
11
EOD
12
type: install
13
}
14
{
15
message: <<EOD
16
Ansible has been updated to 2.9. Please follow the porting guide
17
to update the rulesets:
18
19
https://docs.ansible.com/ansible/devel/porting_guides/porting_guide_2.9.html
20
21
If you wish to stay with version 2.8, you can switch to the
22
new port sysutils/ansible28, which tracks the stable 2.8 branch:
23
24
# pkg set -n ansible:ansible28
25
26
EOD
27
maximum_version: "2.9"
28
type: upgrade
29
}
30
]
(-)sysutils/ansible29/pkg-descr (+4 lines)
Line 0 Link Here
1
Ansible is a radically simple configuration-management, deployment,
2
task-execution, and multinode orchestration framework.
3
4
WWW: https://www.ansible.com/

Return to bug 250622