mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-31 05:19:09 -07:00
Fixes for su on freebsd
Addresses multiple issues when using su on freebsd including * su prompt differs between platforms, so turned that check into a regex comparison instead of a simple string comparison * not using '-c' after su causes problems, so added that for all platforms * fixed quoting issues due to multiple uses of '-c' introduced by the above fix Fixes #7503 Fixes #7507
This commit is contained in:
parent
10414145b2
commit
1e672a0fec
4 changed files with 20 additions and 6 deletions
|
@ -3,6 +3,7 @@
|
|||
import unittest
|
||||
import os
|
||||
import os.path
|
||||
import re
|
||||
import tempfile
|
||||
import yaml
|
||||
import passlib.hash
|
||||
|
@ -511,8 +512,8 @@ class TestUtils(unittest.TestCase):
|
|||
cmd = ansible.utils.make_su_cmd('root', '/bin/sh', '/bin/ls')
|
||||
self.assertTrue(isinstance(cmd, tuple))
|
||||
self.assertEqual(len(cmd), 3)
|
||||
self.assertTrue(' root /bin/sh' in cmd[0])
|
||||
self.assertTrue(cmd[1] == 'assword: ')
|
||||
self.assertTrue(' root -c "/bin/sh' in cmd[0])
|
||||
self.assertTrue(re.compile(cmd[1]))
|
||||
self.assertTrue('echo SUDO-SUCCESS-' in cmd[0] and cmd[2].startswith('SUDO-SUCCESS-'))
|
||||
|
||||
def test_to_unicode(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue