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:
parent
2be739ef05
commit
15e9f04f86
2 changed files with 5 additions and 4 deletions
|
@ -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).
|
|
@ -40,7 +40,7 @@ DOCUMENTATION = '''
|
||||||
- name: ANSIBLE_DOAS_EXE
|
- name: ANSIBLE_DOAS_EXE
|
||||||
become_flags:
|
become_flags:
|
||||||
description: Options to pass to doas
|
description: Options to pass to doas
|
||||||
default:
|
default: ''
|
||||||
ini:
|
ini:
|
||||||
- section: privilege_escalation
|
- section: privilege_escalation
|
||||||
key: become_flags
|
key: become_flags
|
||||||
|
@ -117,9 +117,8 @@ class BecomeModule(BecomeBase):
|
||||||
if not self.get_option('become_pass') and '-n' not in flags:
|
if not self.get_option('become_pass') and '-n' not in flags:
|
||||||
flags += ' -n'
|
flags += ' -n'
|
||||||
|
|
||||||
user = self.get_option('become_user')
|
become_user = self.get_option('become_user')
|
||||||
if user:
|
user = '-u %s' % (become_user) if become_user else ''
|
||||||
user = '-u %s' % (user)
|
|
||||||
|
|
||||||
success_cmd = self._build_success_command(cmd, shell, noexe=True)
|
success_cmd = self._build_success_command(cmd, shell, noexe=True)
|
||||||
executable = getattr(shell, 'executable', shell.SHELL_FAMILY)
|
executable = getattr(shell, 'executable', shell.SHELL_FAMILY)
|
||||||
|
|
Loading…
Reference in a new issue