pbrun: Use default value for become_user (#59754)

* Update pbrun.py

Require ternary operator for if get_option('user') returns NoneType object.

* Update pbrun.py

Added default value to become_user in documentation.

* Update pbrun.py

Changed default for become_user to be '' instead of root.
This commit is contained in:
nick6655 2019-07-30 08:15:48 -07:00 committed by Brian Coca
parent 05c586e3ef
commit 1d560e5ce9

View file

@ -14,6 +14,7 @@ DOCUMENTATION = """
options:
become_user:
description: User you 'become' to execute the task
default: ''
ini:
- section: privilege_escalation
key: become_user
@ -95,7 +96,7 @@ class BecomeModule(BecomeBase):
become_exe = self.get_option('become_exe') or self.name
flags = self.get_option('become_flags') or ''
user = self.get_option('become_user')
user = self.get_option('become_user') or ''
if user:
user = '-u %s' % (user)
noexe = not self.get_option('wrap_exe')