Remove deprecation, add logic to state.py

This commit is contained in:
twangboy 2017-07-28 11:39:02 -06:00
parent 464ec34713
commit 0c9e40012b
2 changed files with 10 additions and 56 deletions

View file

@ -1752,7 +1752,11 @@ class State(object):
ret = {'result': False, 'name': low['name'], 'changes': {}}
self.state_con['runas'] = low.get('runas', None)
self.state_con['runas_password'] = low.get('runas_password', None)
if low['state'] == 'cmd' and 'password' in low:
self.state_con['runas_password'] = low['password']
else:
self.state_con['runas_password'] = low.get('runas_password', None)
if not low.get('__prereq__'):
log.info(

View file

@ -654,7 +654,6 @@ def run(name,
creates=None,
cwd=None,
runas=None,
runas_password=None,
shell=None,
env=None,
stateful=False,
@ -688,9 +687,6 @@ def run(name,
runas
The user name to run the command as
runas_password
The password of the user specified in runas. Required for Windows
shell
The shell to use for execution, defaults to the shell grain
@ -833,20 +829,9 @@ def run(name,
if 'user' in kwargs and kwargs['user'] is not None and runas is None:
runas = kwargs.pop('user')
if 'password' in kwargs:
runas_password = kwargs.pop('password')
salt.utils.warn_until(
'Neon',
'The legacy password argument is deprecated. Use runas_password'
'instead. This warning will be removed in Salt Neon')
if runas is not None:
__context__['runas'] = runas
if runas_password is not None:
__context__['runas_password'] = runas_password
cmd_kwargs = copy.deepcopy(kwargs)
cmd_kwargs.update({'cwd': cwd,
'runas': runas,
'use_vt': use_vt,
'shell': shell or __grains__['shell'],
'env': env,
@ -906,7 +891,6 @@ def script(name,
creates=None,
cwd=None,
runas=None,
runas_password=None,
shell=None,
env=None,
stateful=False,
@ -949,9 +933,6 @@ def script(name,
runas
The name of the user to run the command as
runas_password
The password of the user specified in runas. Required for Windows
shell
The shell to use for execution. The default is set in grains['shell']
@ -1084,20 +1065,9 @@ def script(name,
if 'user' in kwargs and kwargs['user'] is not None and runas is None:
runas = kwargs.pop('user')
if 'password' in kwargs:
runas_password = kwargs.pop('password')
salt.utils.warn_until(
'Neon',
'The legacy password argument is deprecated. Use runas_password'
'instead. This warning will be removed in Salt Neon')
if runas is not None:
__context__['runas'] = runas
if runas_password is not None:
__context__['runas_password'] = runas_password
cmd_kwargs = copy.deepcopy(kwargs)
cmd_kwargs.update({'shell': shell or __grains__['shell'],
cmd_kwargs.update({'runas': runas,
'shell': shell or __grains__['shell'],
'env': env,
'onlyif': onlyif,
'unless': unless,
@ -1112,6 +1082,7 @@ def script(name,
run_check_cmd_kwargs = {
'cwd': cwd,
'runas': runas,
'shell': shell or __grains__['shell']
}
@ -1214,29 +1185,8 @@ def call(name,
'result': False,
'comment': ''}
if 'user' in kwargs or 'group' in kwargs:
salt.utils.warn_until(
'Oxygen',
'The legacy user/group arguments are deprecated. '
'Replace them with runas. '
'These arguments will be removed in Salt Oxygen.'
)
if 'user' in kwargs and kwargs['user'] is not None and runas is None:
runas = kwargs.pop('user')
if 'password' in kwargs:
runas_password = kwargs.pop('password')
salt.utils.warn_until(
'Neon',
'The legacy password argument is deprecated. Use runas_password'
'instead. This warning will be removed in Salt Neon')
if runas is not None:
__context__['runas'] = runas
if runas_password is not None:
__context__['runas_password'] = runas_password
cmd_kwargs = {'cwd': kwargs.get('cwd'),
'runas': kwargs.get('user'),
'shell': kwargs.get('shell') or __grains__['shell'],
'env': kwargs.get('env'),
'use_vt': use_vt,