Skip to content

Commit 660d3e0

Browse files
authored
Merge pull request #932 from moreati/release-0.3.3
Release 0.3.3
2 parents bd3cfb4 + 8ab8423 commit 660d3e0

File tree

167 files changed

+1411
-1589
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+1411
-1589
lines changed

.ci/ansible_tests.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import sys
88

99
import ci_lib
10-
from ci_lib import run
1110

1211

1312
TESTS_DIR = os.path.join(ci_lib.GIT_ROOT, 'tests/ansible')
@@ -40,10 +39,10 @@ def pause_if_interactive():
4039
os.chdir(TESTS_DIR)
4140
os.chmod('../data/docker/mitogen__has_sudo_pubkey.key', int('0600', 7))
4241

43-
run("mkdir %s", HOSTS_DIR)
42+
ci_lib.run("mkdir %s", HOSTS_DIR)
4443
for path in glob.glob(TESTS_DIR + '/hosts/*'):
4544
if not path.endswith('default.hosts'):
46-
run("ln -s %s %s", path, HOSTS_DIR)
45+
ci_lib.run("ln -s %s %s", path, HOSTS_DIR)
4746

4847
inventory_path = os.path.join(HOSTS_DIR, 'target')
4948
with open(inventory_path, 'w') as fp:
@@ -63,14 +62,14 @@ def pause_if_interactive():
6362
ci_lib.dump_file(inventory_path)
6463

6564
if not ci_lib.exists_in_path('sshpass'):
66-
run("sudo apt-get update")
67-
run("sudo apt-get install -y sshpass")
65+
ci_lib.run("sudo apt-get update")
66+
ci_lib.run("sudo apt-get install -y sshpass")
6867

6968

7069
with ci_lib.Fold('ansible'):
7170
playbook = os.environ.get('PLAYBOOK', 'all.yml')
7271
try:
73-
run('./run_ansible_playbook.py %s -i "%s" %s',
72+
ci_lib.run('./run_ansible_playbook.py %s -i "%s" %s',
7473
playbook, HOSTS_DIR, ' '.join(sys.argv[1:]))
7574
except:
7675
pause_if_interactive()

.ci/azure-pipelines.yml

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ jobs:
2525
Mito_36:
2626
python.version: '3.6'
2727
tox.env: py36-mode_mitogen
28-
Mito_39:
29-
python.version: '3.9'
30-
tox.env: py39-mode_mitogen
28+
Mito_310:
29+
python.version: '3.10'
30+
tox.env: py310-mode_mitogen
3131

3232
# TODO: test python3, python3 tests are broken
3333
Loc_27_210:
@@ -72,9 +72,9 @@ jobs:
7272
Mito_37:
7373
python.version: '3.7'
7474
tox.env: py37-mode_mitogen
75-
Mito_39:
76-
python.version: '3.9'
77-
tox.env: py39-mode_mitogen
75+
Mito_310:
76+
python.version: '3.10'
77+
tox.env: py310-mode_mitogen
7878

7979
# TODO: test python3, python3 tests are broken
8080
Loc_27_210:
@@ -162,33 +162,33 @@ jobs:
162162
python.version: '3.6'
163163
tox.env: py36-mode_mitogen-distro_ubuntu2004
164164

165-
Mito_39_centos6:
166-
python.version: '3.9'
167-
tox.env: py39-mode_mitogen-distro_centos6
168-
Mito_39_centos7:
169-
python.version: '3.9'
170-
tox.env: py39-mode_mitogen-distro_centos7
171-
Mito_39_centos8:
172-
python.version: '3.9'
173-
tox.env: py39-mode_mitogen-distro_centos8
174-
Mito_39_debian9:
175-
python.version: '3.9'
176-
tox.env: py39-mode_mitogen-distro_debian9
177-
Mito_39_debian10:
178-
python.version: '3.9'
179-
tox.env: py39-mode_mitogen-distro_debian10
180-
Mito_39_debian11:
181-
python.version: '3.9'
182-
tox.env: py39-mode_mitogen-distro_debian11
183-
Mito_39_ubuntu1604:
184-
python.version: '3.9'
185-
tox.env: py39-mode_mitogen-distro_ubuntu1604
186-
Mito_39_ubuntu1804:
187-
python.version: '3.9'
188-
tox.env: py39-mode_mitogen-distro_ubuntu1804
189-
Mito_39_ubuntu2004:
190-
python.version: '3.9'
191-
tox.env: py39-mode_mitogen-distro_ubuntu2004
165+
Mito_310_centos6:
166+
python.version: '3.10'
167+
tox.env: py310-mode_mitogen-distro_centos6
168+
Mito_310_centos7:
169+
python.version: '3.10'
170+
tox.env: py310-mode_mitogen-distro_centos7
171+
Mito_310_centos8:
172+
python.version: '3.10'
173+
tox.env: py310-mode_mitogen-distro_centos8
174+
Mito_310_debian9:
175+
python.version: '3.10'
176+
tox.env: py310-mode_mitogen-distro_debian9
177+
Mito_310_debian10:
178+
python.version: '3.10'
179+
tox.env: py310-mode_mitogen-distro_debian10
180+
Mito_310_debian11:
181+
python.version: '3.10'
182+
tox.env: py310-mode_mitogen-distro_debian11
183+
Mito_310_ubuntu1604:
184+
python.version: '3.10'
185+
tox.env: py310-mode_mitogen-distro_ubuntu1604
186+
Mito_310_ubuntu1804:
187+
python.version: '3.10'
188+
tox.env: py310-mode_mitogen-distro_ubuntu1804
189+
Mito_310_ubuntu2004:
190+
python.version: '3.10'
191+
tox.env: py310-mode_mitogen-distro_ubuntu2004
192192

193193
#DebOps_2460_27_27:
194194
#python.version: '2.7'
@@ -247,15 +247,15 @@ jobs:
247247
python.version: '3.6'
248248
tox.env: py36-mode_ansible-ansible4
249249

250-
Ans_39_210:
251-
python.version: '3.9'
252-
tox.env: py39-mode_ansible-ansible2.10
253-
Ans_39_3:
254-
python.version: '3.9'
255-
tox.env: py39-mode_ansible-ansible3
256-
Ans_39_4:
257-
python.version: '3.9'
258-
tox.env: py39-mode_ansible-ansible4
259-
Ans_39_5:
260-
python.version: '3.9'
261-
tox.env: py39-mode_ansible-ansible5
250+
Ans_310_210:
251+
python.version: '3.10'
252+
tox.env: py310-mode_ansible-ansible2.10
253+
Ans_310_3:
254+
python.version: '3.10'
255+
tox.env: py310-mode_ansible-ansible3
256+
Ans_310_4:
257+
python.version: '3.10'
258+
tox.env: py310-mode_ansible-ansible4
259+
Ans_310_5:
260+
python.version: '3.10'
261+
tox.env: py310-mode_ansible-ansible5

.ci/ci_lib.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
from __future__ import absolute_import
32
from __future__ import print_function
43

@@ -193,8 +192,6 @@ def __enter__(self): pass
193192
def __exit__(self, _1, _2, _3): pass
194193

195194

196-
os.environ.setdefault('ANSIBLE_STRATEGY',
197-
os.environ.get('STRATEGY', 'mitogen_linear'))
198195
GIT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
199196
# Used only when MODE=mitogen
200197
DISTRO = os.environ.get('DISTRO', 'debian9')

.ci/debops_common_install.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
ci_lib.run_batches([
99
[
10-
'pip install -qqq "debops[ansible]==2.1.2"',
10+
'python -m pip --no-python-version-warning --disable-pip-version-check "debops[ansible]==2.1.2"',
1111
],
1212
[
1313
'aws ecr-public get-login-password | docker login --username AWS --password-stdin public.ecr.aws',

.ci/localhost_ansible_tests.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
# Run tests/ansible/all.yml under Ansible and Ansible-Mitogen
33

44
import os
5+
import subprocess
56
import sys
67

78
import ci_lib
8-
from ci_lib import run
99

1010

1111
TESTS_DIR = os.path.join(ci_lib.GIT_ROOT, 'tests/ansible')
@@ -24,37 +24,38 @@
2424
# NOTE: sshpass v1.06 causes errors so pegging to 1.05 -> "msg": "Error when changing password","out": "passwd: DS error: eDSAuthFailed\n",
2525
# there's a checksum error with "brew install http://git.io/sshpass.rb" though, so installing manually
2626
if not ci_lib.exists_in_path('sshpass'):
27-
os.system("curl -O -L https://sourceforge.net/projects/sshpass/files/sshpass/1.05/sshpass-1.05.tar.gz && \
27+
subprocess.check_call(
28+
"curl -O -L https://sourceforge.net/projects/sshpass/files/sshpass/1.05/sshpass-1.05.tar.gz && \
2829
tar xvf sshpass-1.05.tar.gz && \
2930
cd sshpass-1.05 && \
3031
./configure && \
31-
sudo make install")
32+
sudo make install",
33+
shell=True,
34+
)
3235

3336

3437
with ci_lib.Fold('machine_prep'):
3538
# generate a new ssh key for localhost ssh
3639
if not os.path.exists(os.path.expanduser("~/.ssh/id_rsa")):
37-
os.system("ssh-keygen -P '' -m pem -f ~/.ssh/id_rsa")
38-
os.system("cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys")
40+
subprocess.check_call("ssh-keygen -P '' -m pem -f ~/.ssh/id_rsa", shell=True)
41+
subprocess.check_call("cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys", shell=True)
42+
os.chmod(os.path.expanduser('~/.ssh'), int('0700', 8))
43+
os.chmod(os.path.expanduser('~/.ssh/authorized_keys'), int('0600', 8))
3944

4045
# also generate it for the sudo user
41-
if os.system("sudo [ -f /var/root/.ssh/id_rsa ]") != 0:
42-
os.system("sudo ssh-keygen -P '' -m pem -f /var/root/.ssh/id_rsa")
43-
os.system("sudo cat /var/root/.ssh/id_rsa.pub | sudo tee -a /var/root/.ssh/authorized_keys")
44-
45-
os.chmod(os.path.expanduser('~/.ssh'), int('0700', 8))
46-
os.chmod(os.path.expanduser('~/.ssh/authorized_keys'), int('0600', 8))
47-
# run chmod through sudo since it's owned by root
48-
os.system('sudo chmod 700 /var/root/.ssh')
49-
os.system('sudo chmod 600 /var/root/.ssh/authorized_keys')
46+
if os.system("sudo [ -f ~root/.ssh/id_rsa ]") != 0:
47+
subprocess.check_call("sudo ssh-keygen -P '' -m pem -f ~root/.ssh/id_rsa", shell=True)
48+
subprocess.check_call("sudo cat ~root/.ssh/id_rsa.pub | sudo tee -a ~root/.ssh/authorized_keys", shell=True)
49+
subprocess.check_call('sudo chmod 700 ~root/.ssh', shell=True)
50+
subprocess.check_call('sudo chmod 600 ~root/.ssh/authorized_keys', shell=True)
5051

5152
if os.path.expanduser('~mitogen__user1') == '~mitogen__user1':
5253
os.chdir(IMAGE_PREP_DIR)
53-
run("ansible-playbook -c local -i localhost, _user_accounts.yml")
54+
ci_lib.run("ansible-playbook -c local -i localhost, _user_accounts.yml")
5455

5556

5657
with ci_lib.Fold('ansible'):
5758
os.chdir(TESTS_DIR)
5859
playbook = os.environ.get('PLAYBOOK', 'all.yml')
59-
run('./run_ansible_playbook.py %s -l target %s',
60+
ci_lib.run('./run_ansible_playbook.py %s -l target %s',
6061
playbook, ' '.join(sys.argv[1:]))

ansible_mitogen/affinity.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@
7373
decisions.
7474
"""
7575

76-
from __future__ import absolute_import
76+
from __future__ import absolute_import, division, print_function
77+
__metaclass__ = type
78+
7779
import ctypes
7880
import logging
7981
import mmap

ansible_mitogen/connection.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@
2626
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2727
# POSSIBILITY OF SUCH DAMAGE.
2828

29-
from __future__ import absolute_import
29+
from __future__ import absolute_import, division, print_function
3030
from __future__ import unicode_literals
31+
__metaclass__ = type
3132

3233
import errno
3334
import logging
@@ -40,10 +41,8 @@
4041
import ansible.constants as C
4142
import ansible.errors
4243
import ansible.plugins.connection
43-
import ansible.utils.shlex
4444

4545
import mitogen.core
46-
import mitogen.fork
4746
import mitogen.utils
4847

4948
import ansible_mitogen.mixins
@@ -262,6 +261,21 @@ def _connect_machinectl(spec):
262261
return _connect_setns(spec, kind='machinectl')
263262

264263

264+
def _connect_podman(spec):
265+
"""
266+
Return ContextService arguments for a Docker connection.
267+
"""
268+
return {
269+
'method': 'podman',
270+
'kwargs': {
271+
'username': spec.remote_user(),
272+
'container': spec.remote_addr(),
273+
'python_path': spec.python_path(rediscover_python=True),
274+
'connect_timeout': spec.ansible_ssh_timeout() or spec.timeout(),
275+
'remote_name': get_remote_name(spec),
276+
}
277+
}
278+
265279
def _connect_setns(spec, kind=None):
266280
"""
267281
Return ContextService arguments for a mitogen_setns connection.
@@ -400,6 +414,7 @@ def _connect_mitogen_doas(spec):
400414
'lxc': _connect_lxc,
401415
'lxd': _connect_lxd,
402416
'machinectl': _connect_machinectl,
417+
'podman': _connect_podman,
403418
'setns': _connect_setns,
404419
'ssh': _connect_ssh,
405420
'smart': _connect_ssh, # issue #548.
@@ -1081,7 +1096,7 @@ def put_file(self, in_path, out_path):
10811096
s = fp.read(self.SMALL_FILE_LIMIT + 1)
10821097
finally:
10831098
fp.close()
1084-
except OSError:
1099+
except OSError as e:
10851100
self._throw_io_error(e, in_path)
10861101
raise
10871102

ansible_mitogen/loaders.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@
3030
Stable names for PluginLoader instances across Ansible versions.
3131
"""
3232

33-
from __future__ import absolute_import
33+
from __future__ import absolute_import, division, print_function
34+
__metaclass__ = type
35+
36+
import ansible.errors
3437

3538
import ansible_mitogen.utils
3639

ansible_mitogen/logging.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2727
# POSSIBILITY OF SUCH DAMAGE.
2828

29-
from __future__ import absolute_import
29+
from __future__ import absolute_import, division, print_function
30+
__metaclass__ = type
31+
3032
import logging
3133
import os
3234

@@ -36,8 +38,8 @@
3638
try:
3739
from __main__ import display
3840
except ImportError:
39-
from ansible.utils.display import Display
40-
display = Display()
41+
import ansible.utils.display
42+
display = ansible.utils.display.Display()
4143

4244

4345
#: The process name set via :func:`set_process_name`.

ansible_mitogen/mixins.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2727
# POSSIBILITY OF SUCH DAMAGE.
2828

29-
from __future__ import absolute_import
29+
from __future__ import absolute_import, division, print_function
30+
__metaclass__ = type
31+
3032
import logging
3133
import os
3234
import pwd

0 commit comments

Comments
 (0)