Merge pull request #13451 from bcoca/doas_fix

fixed doas from getting stuck when needing passwords
This commit is contained in:
Brian Coca 2015-12-08 11:13:01 -05:00
commit e69064d0fc
2 changed files with 2 additions and 2 deletions

View file

@ -481,7 +481,7 @@ class PlayContext(Base):
if self.become_user:
flags += ' -u %s ' % self.become_user
becomecmd = '%s %s echo %s && %s %s env ANSIBLE=true %s' % (exe, flags, success_key, exe, flags, cmd)
becomecmd = '%s %s %s -c %s' % (exe, flags, executable, success_cmd)
else:
raise AnsibleError("Privilege escalation method not found: %s" % self.become_method)

View file

@ -161,7 +161,7 @@ class TestPlayContext(unittest.TestCase):
play_context.become_method = 'doas'
cmd = play_context.make_become_cmd(cmd=default_cmd, executable="/bin/bash")
self.assertEqual(cmd, """%s -c '%s %s echo %s && %s %s env ANSIBLE=true %s'""" % (default_exe, doas_exe, doas_flags, play_context.success_key, doas_exe, doas_flags, default_cmd))
self.assertEqual(cmd, """%s -c '%s %s %s -c '"'"'echo %s; %s'"'"''""" % (default_exe, doas_exe, doas_flags, default_exe, play_context.success_key, default_cmd))
play_context.become_method = 'bad'
self.assertRaises(AnsibleError, play_context.make_become_cmd, cmd=default_cmd, executable="/bin/bash")