Skip to content

Commit 333151f

Browse files
committed
Merge remote-tracking branch 'origin/issue575'
* origin/issue575: issue #574: fix ISSUE_TEMPLATE link issue #575: fix exception text rendering
2 parents 9739f55 + a77d535 commit 333151f

File tree

4 files changed

+42
-4
lines changed

4 files changed

+42
-4
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ the following checklist as a guide for what to include.
1010

1111
* Have you tried the latest master version from Git?
1212
* Do you have some idea of what the underlying problem may be?
13-
https://mitogen.rtfd.io/en/stable/ansible.html#common-problems has
13+
https://mitogen.networkgenomics.com/ansible_detailed.html#common-problems has
1414
instructions to help figure out the likely cause and how to gather relevant
1515
logs.
1616
* Mention your host and target OS and versions

ansible_mitogen/target.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
u"were mounted on 'noexec' filesystems.\n"
9494
u"\n"
9595
u"The following paths were tried:\n"
96-
u" %(namelist)s\n"
96+
u" %(paths)s\n"
9797
u"\n"
9898
u"Please check '-vvv' output for a log of individual path errors."
9999
)

docs/changelog.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ Fixes
2727
* `#557 <https://github.com/dw/mitogen/issues/557>`_: fix a crash when running
2828
on machines with high CPU counts.
2929

30+
* `#575 <https://github.com/dw/mitogen/issues/575>`_: fix a crash when
31+
rendering an error message to indicate no usable temporary directories could
32+
be found.
33+
3034
* `#570 <https://github.com/dw/mitogen/issues/570>`_: the ``firewalld`` module
3135
internally caches a dbus name that changes across ``firewalld`` restarts,
3236
causing a failure if the service is restarted between ``firewalld`` module invocations.
@@ -37,7 +41,8 @@ Thanks!
3741

3842
Mitogen would not be possible without the support of users. A huge thanks for
3943
bug reports, testing, features and fixes in this release contributed by
40-
`Orion Poplawski <https://github.com/opoplawski>`_, and
44+
`Orion Poplawski <https://github.com/opoplawski>`_,
45+
`Thibaut Barrère <https://github.com/thbar>`_, and
4146
`@Moumoutaru <https://github.com/Moumoutaru>`_.
4247

4348

tests/ansible/tests/target_test.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,47 @@
1515

1616

1717
class NamedTemporaryDirectory(object):
18+
def __init__(self, **kwargs):
19+
self.kwargs = kwargs
20+
1821
def __enter__(self):
19-
self.path = tempfile.mkdtemp()
22+
self.path = tempfile.mkdtemp(**self.kwargs)
2023
return self.path
2124

2225
def __exit__(self, _1, _2, _3):
2326
subprocess.check_call(['rm', '-rf', self.path])
2427

2528

29+
class FindGoodTempDirTest(testlib.TestCase):
30+
func = staticmethod(ansible_mitogen.target.find_good_temp_dir)
31+
32+
def test_expands_usernames(self):
33+
with NamedTemporaryDirectory(
34+
prefix='.ansible_mitogen_test',
35+
dir=os.environ['HOME']
36+
) as tmpdir:
37+
path = self.func(['~'])
38+
self.assertTrue(path.startswith(os.environ['HOME']))
39+
40+
def test_expands_vars(self):
41+
with NamedTemporaryDirectory(
42+
prefix='.ansible_mitogen_test',
43+
dir=os.environ['HOME']
44+
) as tmpdir:
45+
os.environ['somevar'] = 'xyz'
46+
path = self.func([tmpdir + '/$somevar'])
47+
self.assertTrue(path.startswith('%s/%s' % (tmpdir, 'xyz')))
48+
49+
@mock.patch('ansible_mitogen.target.is_good_temp_dir')
50+
def test_no_good_candidate(self, is_good_temp_dir):
51+
is_good_temp_dir.return_value = False
52+
e = self.assertRaises(IOError,
53+
lambda: self.func([])
54+
)
55+
self.assertTrue(str(e).startswith('Unable to find a useable'))
56+
57+
58+
2659
class ApplyModeSpecTest(unittest2.TestCase):
2760
func = staticmethod(ansible_mitogen.target.apply_mode_spec)
2861

0 commit comments

Comments
 (0)