Fix become plugins (#50)

* Fix become plugins.

* Fix become unit tests to avoid play_context.make_become_cmd.

* Remove hack.

* Remove explicit defaults. Adjust tests to be more like Ansible itself.

* Forgot two lines.

* Rewrite tests (again).

* Rename play_context -> task, add possibility to pass var_options.

* Add var_options variants.

* Properly test overwriting.
This commit is contained in:
Felix Fontein 2020-03-30 19:09:45 +02:00 committed by GitHub
commit 0026c9f5b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 238 additions and 84 deletions

View file

@ -82,14 +82,14 @@ class BecomeModule(BecomeBase):
if not cmd:
return cmd
becomecmd = self.get_option('become_exe') or self.name
becomecmd = self.get_option('become_exe')
flags = self.get_option('become_flags') or ''
flags = self.get_option('become_flags')
if self.get_option('become_pass'):
self.prompt = '[dzdo via ansible, key=%s] password:' % self._id
flags = '%s -p "%s"' % (flags.replace('-n', ''), self.prompt)
user = self.get_option('become_user') or ''
user = self.get_option('become_user')
if user:
user = '-u %s' % (user)