Skip to content

Commit

Permalink
{sudo,su}_user does not imply become
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoca committed Oct 2, 2015
1 parent 5737290 commit c27bd4f
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions lib/ansible/playbook/become.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@
from ansible import constants as C
from ansible.errors import AnsibleError, AnsibleParserError
from ansible.playbook.attribute import Attribute, FieldAttribute
#from ansible.utils.display import deprecated

try:
from __main__ import display
display = display
except ImportError:
from ansible.utils.display import Display
display = Display()

class Become:

Expand Down Expand Up @@ -66,26 +72,24 @@ def _preprocess_data_become(self, ds):
if 'sudo' in ds:
ds['become'] = ds['sudo']
del ds['sudo']
else:
ds['become'] = True

if 'sudo_user' in ds:
ds['become_user'] = ds['sudo_user']
del ds['sudo_user']

#deprecated("Instead of sudo/sudo_user, use become/become_user and set become_method to 'sudo' (default)")
display.deprecated("Instead of sudo/sudo_user, use become/become_user and make sure become_method is 'sudo' (default)")

elif 'su' in ds or 'su_user' in ds:
ds['become_method'] = 'su'
if 'su' in ds:
ds['become'] = ds['su']
del ds['su']
else:
ds['become'] = True

if 'su_user' in ds:
ds['become_user'] = ds['su_user']
del ds['su_user']

#deprecated("Instead of su/su_user, use become/become_user and set become_method to 'su' (default is sudo)")
display.deprecated("Instead of su/su_user, use become/become_user and set become_method to 'su' (default is sudo)")

# if we are becoming someone else, but some fields are unset,
# make sure they're initialized to the default config values
Expand Down

0 comments on commit c27bd4f

Please sign in to comment.