1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

doas: properly set the default values (#704)

* doas: properly set the default values

The module expects by default:

- `become_user` to be `None` or a string,
- `become_flags` to by an empty string.

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Gonéri Le Bouder 2020-07-29 01:55:01 -04:00 committed by GitHub
parent 2be739ef05
commit 15e9f04f86
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- doas become plugin - address a bug with the parameters handling that was breaking the plugin in community.general when `become_flags` and `become_user` were not explicitly specified (https://github.com/ansible-collections/community.general/pull/704).

View file

@ -40,7 +40,7 @@ DOCUMENTATION = '''
- name: ANSIBLE_DOAS_EXE
become_flags:
description: Options to pass to doas
default:
default: ''
ini:
- section: privilege_escalation
key: become_flags
@ -117,9 +117,8 @@ class BecomeModule(BecomeBase):
if not self.get_option('become_pass') and '-n' not in flags:
flags += ' -n'
user = self.get_option('become_user')
if user:
user = '-u %s' % (user)
become_user = self.get_option('become_user')
user = '-u %s' % (become_user) if become_user else ''
success_cmd = self._build_success_command(cmd, shell, noexe=True)
executable = getattr(shell, 'executable', shell.SHELL_FAMILY)