Merge pull request #40778 from rallytime/oxygen-deprecations

Start removing deprecated code for Oxygen release
This commit is contained in:
Mike Place 2017-04-23 04:30:51 -06:00 committed by GitHub
commit b5179aa873
9 changed files with 62 additions and 335 deletions

View File

@ -3,3 +3,62 @@
====================================
Salt Release Notes - Codename Oxygen
====================================
Configuration Option Deprecations
---------------------------------
- The ``requests_lib`` configuration option has been removed. Please use
``backend`` instead.
Module Deprecations
-------------------
The ``win_psget`` module had the following changes:
- The ``psversion`` function was removed. Please use ``cmd.shell_info`` instead.
The ``win_service`` module had the following changes:
- The ``config`` function was removed. Please use the ``modify`` function
instead.
- The ``binpath`` option was removed from the ``create`` function. Please use
``bin_path`` instead.
- The ``depend`` option was removed from the ``create`` function. Please use
``dependencies`` instead.
- The ``DisplayName`` option was removed from the ``create`` function. Please
use ``display_name`` instead.
- The ``error`` option was removed from the ``create`` function. Please use
``error_control`` instead.
- The ``group`` option was removed from the ``create`` function. Please use
``load_order_group`` instead.
- The ``obj`` option was removed from the ``create`` function. Please use
``account_name`` instead.
- The ``password`` option was removed from the ``create`` function. Please use
``account_password`` instead.
- The ``start`` option was removed from the ``create`` function. Please use
``start_type`` instead.
- The ``type`` option was removed from the ``create`` function. Please use
``service_type`` instead.
State Deprecations
------------------
The ``archive`` state had the following changes:
- The ``tar_options`` and the ``zip_options`` options were removed from the
``extracted`` function. Please use ``options`` instead.
The ``cmd`` state had the following changes:
- The ``user`` and ``group`` options were removed from the ``run`` function.
Please use ``runas`` instead.
- The ``user`` and ``group`` options were removed from the ``script`` function.
Please use ``runas`` instead.
- The ``user`` and ``group`` options were removed from the ``wait`` function.
Please use ``runas`` instead.
- The ``user`` and ``group`` options were removed from the ``wait_script``
function. Please use ``runas`` instead.
The ``file`` state had the following changes:
- The ``show_diff`` option was removed. Please use ``show_changes`` instead.

View File

@ -3384,14 +3384,6 @@ def query(path, method='GET', data=None, params=None, header_dict=None, decode=T
search_global=False,
default='management.core.windows.net'
)
requests_lib = config.get_cloud_config_value(
'requests_lib',
get_configured_provider(), __opts__, search_global=False
)
if requests_lib is not None:
salt.utils.warn_until('Oxygen', '"requests_lib:True" has been replaced by "backend:requests", '
'please change your config')
backend = config.get_cloud_config_value(
'backend',
get_configured_provider(), __opts__, search_global=False
@ -3416,7 +3408,6 @@ def query(path, method='GET', data=None, params=None, header_dict=None, decode=T
port=443,
text=True,
cert=certificate_path,
requests_lib=requests_lib,
backend=backend,
decode=decode,
decode_type='xml',

View File

@ -74,33 +74,6 @@ def _pshell(cmd, cwd=None, json_depth=2):
return ret
def psversion():
'''
Returns the Powershell version
This has been deprecated and has been replaced by ``cmd.shell_info`` Note
the minimum version return is 5 as ``dsc`` is not available for version
less than 5. This function will be removed in 'Oxygen' release.
CLI Example:
.. code-block:: bash
salt 'win01' dsc.psversion
'''
salt.utils.warn_until('Oxygen',
'The \'psversion\' has been deprecated and has been '
'replaced by \'cmd.shell_info\'.'
)
powershell_info = __salt__['cmd.shell_info']('powershell')
if powershell_info['installed']:
try:
return int(powershell_info['version'].split('.')[0])
except ValueError:
pass
return 0
def bootstrap():
'''
Make sure that nuget-anycpu.exe is installed.

View File

@ -974,100 +974,9 @@ def create(name,
salt '*' service.create <service name> <path to exe> display_name='<display name>'
'''
# Deprecations
if 'binpath' in kwargs:
salt.utils.warn_until(
'Oxygen',
'The \'binpath\' argument to service.create is deprecated, and '
'will be removed in Salt {version}. Please use \'bin_path\' '
'instead.'
)
if bin_path is None:
bin_path = kwargs.pop('binpath')
if 'DisplayName' in kwargs:
salt.utils.warn_until(
'Oxygen',
'The \'DisplayName\' argument to service.create is deprecated, and '
'will be removed in Salt {version}. Please use \'display_name\' '
'instead.'
)
if display_name is None:
display_name = kwargs.pop('DisplayName')
if display_name is None:
display_name = name
if 'type' in kwargs:
salt.utils.warn_until(
'Oxygen',
'The \'type\' argument to service.create is deprecated, and '
'will be removed in Salt {version}. Please use \'service_type\' '
'instead.'
)
if service_type is None:
service_type = kwargs.pop('type')
if 'start' in kwargs:
salt.utils.warn_until(
'Oxygen',
'The \'start\' argument to service.create is deprecated, and '
'will be removed in Salt {version}. Please use \'start_type\' '
'instead.'
)
if start_type is None:
start_type = kwargs.pop('start')
if 'error' in kwargs:
salt.utils.warn_until(
'Oxygen',
'The \'error\' argument to service.create is deprecated, and '
'will be removed in Salt {version}. Please use \'error_control\' '
'instead.'
)
if error_control is None:
error_control = kwargs.pop('error')
if 'group' in kwargs:
salt.utils.warn_until(
'Oxygen',
'The \'group\' argument to service.create is deprecated, and '
'will be removed in Salt {version}. Please use '
'\'load_order_group\' instead.'
)
if load_order_group is None:
load_order_group = kwargs.pop('group')
if 'depend' in kwargs:
salt.utils.warn_until(
'Oxygen',
'The \'depend\' argument to service.create is deprecated, and '
'will be removed in Salt {version}. Please use \'dependencies\' '
'instead.'
)
if dependencies is None:
dependencies = kwargs.pop('depend')
if 'obj' in kwargs:
salt.utils.warn_until(
'Oxygen',
'The \'obj\' argument to service.create is deprecated, and '
'will be removed in Salt {version}. Please use \'account_name\' '
'instead.'
)
if account_name is None:
account_name = kwargs.pop('obj')
if 'password' in kwargs:
salt.utils.warn_until(
'Oxygen',
'The \'password\' argument to service.create is deprecated, and '
'will be removed in Salt {version}. Please use '
'\'account_password\' instead.'
)
if account_password is None:
account_password = kwargs.pop('password')
# Test if the service already exists
if name in get_all():
raise CommandExecutionError('Service Already Exists: {0}'.format(name))
@ -1145,110 +1054,6 @@ def create(name,
return info(name)
def config(name,
bin_path=None,
display_name=None,
svc_type=None,
start_type=None,
error=None,
group=None,
tag=None,
depend=None,
obj=None,
password=None,
**kwargs):
r'''
.. deprecated:: 2016.11.0
Use ``service.modify`` instead
Modify the named service. Because this is deprecated it will use the passed
parameters to run ``service.modify`` instead.
Args:
name (str): Specifies the service name. This is not the display_name
bin_path (str): Specifies the path to the service binary file.
Backslashes must be escaped, eg: C:\\path\\to\\binary.exe
display_name (str): the name to be displayed in the service manager
svc_type (str): Specifies the service type. Default is ``own``.
Valid options are as follows:
- kernel: Driver service
- filesystem: File system driver service
- adapter: Adapter driver service (reserved)
- recognizer: Recognizer driver service (reserved)
- own (default): Service runs in its own process
- share: Service shares a process with one or more other services
start_type (str): Specifies the service start type. Valid options are as
follows:
- boot: Device driver that is loaded by the boot loader
- system: Device driver that is started during kernel initialization
- auto: Service that automatically starts
- manual (default): Service must be started manually
- disabled: Service cannot be started
error (str): The severity of the error, and action taken, if this
service fails to start. Valid options are as follows:
- normal (normal): Error is logged and a message box is displayed
- severe: Error is logged and computer attempts a restart with the
last known good configuration
- critical: Error is logged, computer attempts to restart with the
last known good configuration, system halts on failure
- ignore: Error is logged and startup continues, no notification is
given to the user
group: The name of the load order group to which this service
belongs
depend (list): A list of services or load ordering groups that
must start before this service
obj (str): The name of the account under which the service should run.
For ``own`` type services this should be in the ``domain\username``
format. The following are examples of valid built-in service
accounts:
- NT Authority\\LocalService
- NT Authority\\NetworkService
- NT Authority\\LocalSystem
- .\\LocalSystem
password (str): The password for the account name specified in
``account_name``. For the above built-in accounts, this can be None.
Otherwise a password must be specified.
Returns:
dict: a dictionary of changes made
CLI Example:
.. code-block:: bash
salt '*' service.config <service name> <path to exe> display_name='<display name>'
'''
salt.utils.warn_until(
'Oxygen',
'The \'service.change\' function is deprecated, and will be removed in '
'Salt {version}. Please use \'service.modify\' instead.')
return modify(name=name,
bin_path=bin_path,
display_name=display_name,
service_type=svc_type,
start_type=start_type,
error_control=error,
load_order_group=group,
dependencies=depend,
account_name=obj,
account_password=password)
def delete(name):
'''
Delete the named service

View File

@ -208,7 +208,6 @@ def extracted(name,
- source: salt://apps/src/myapp-16.2.4.tar.gz
- user: www
- group: www
- tar_options: --strip-components=1
With the rewrite for 2016.11.0, these workarounds are no longer
necessary. ``if_missing`` is still a supported argument, but it is no
@ -413,8 +412,6 @@ def extracted(name,
``tar``/``unzip`` implementation on the minion's OS.
.. versionadded:: 2016.11.0
The ``tar_options`` and ``zip_options`` parameters have been
deprecated in favor of a single argument name.
.. versionchanged:: 2015.8.11,2016.3.2
XZ-compressed tar archives no longer require ``J`` to manually be
set in the ``options``, they are now detected automatically and
@ -426,15 +423,6 @@ def extracted(name,
For tar archives, main operators like ``-x``, ``--extract``,
``--get``, ``-c`` and ``-f``/``--file`` should *not* be used here.
tar_options
.. deprecated:: 2016.11.0
Use ``options`` instead.
zip_options
.. versionadded:: 2016.3.1
.. deprecated:: 2016.11.0
Use ``options`` instead.
list_options
**For tar archives only.** This state uses :py:func:`archive.list
<salt.modules.archive.list_>` to discover the contents of the source
@ -761,21 +749,6 @@ def extracted(name,
)
return ret
tar_options = kwargs.pop('tar_options', None)
zip_options = kwargs.pop('zip_options', None)
if tar_options:
msg = ('The \'tar_options\' argument has been deprecated, please use '
'\'options\' instead.')
salt.utils.warn_until('Oxygen', msg)
ret.setdefault('warnings', []).append(msg)
options = tar_options
elif zip_options:
msg = ('The \'zip_options\' argument has been deprecated, please use '
'\'options\' instead.')
salt.utils.warn_until('Oxygen', msg)
ret.setdefault('warnings', []).append(msg)
options = zip_options
if options is not None and not isinstance(options, six.string_types):
options = str(options)

View File

@ -500,16 +500,6 @@ def wait(name,
interactively to the console and the logs.
This is experimental.
'''
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')
# Ignoring our arguments is intentional.
return {'name': name,
'changes': {},
@ -630,16 +620,6 @@ def wait_script(name,
regardless, unless ``quiet`` is used for this value.
'''
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')
# Ignoring our arguments is intentional.
return {'name': name,
'changes': {},
@ -818,16 +798,6 @@ def run(name,
'documentation.')
return ret
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')
cmd_kwargs = copy.deepcopy(kwargs)
cmd_kwargs.update({'cwd': cwd,
'runas': runas,
@ -1054,16 +1024,6 @@ def script(name,
if context:
tmpctx.update(context)
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')
cmd_kwargs = copy.deepcopy(kwargs)
cmd_kwargs.update({'runas': runas,
'shell': shell or __grains__['shell'],

View File

@ -5506,7 +5506,6 @@ def serialize(name,
mode=None,
backup='',
makedirs=False,
show_diff=None,
show_changes=True,
create=True,
merge_if_exists=False,
@ -5579,12 +5578,6 @@ def serialize(name,
.. versionadded:: 2014.1.3
show_diff
DEPRECATED: Please use show_changes.
If set to ``False``, the diff will not be shown in the return data if
changes are made.
show_changes
Output a unified diff of the old file and the new file. If ``False``
return a boolean if any changes were made.
@ -5723,14 +5716,6 @@ def serialize(name,
# Make sure that any leading zeros stripped by YAML loader are added back
mode = salt.utils.normalize_mode(mode)
if show_diff is not None:
show_changes = show_diff
msg = (
'The \'show_diff\' argument to the file.serialized state has been '
'deprecated, please use \'show_changes\' instead.'
)
salt.utils.warn_until('Oxygen', msg)
if __opts__['test']:
ret['changes'] = __salt__['file.check_managed_changes'](
name=name,

View File

@ -9,9 +9,6 @@ Support for Stormpath.
from __future__ import absolute_import
import pprint
# Import salt libs
import salt.utils
def __virtual__():
'''
@ -58,9 +55,7 @@ def present(name, **kwargs):
'''
# Because __opts__ is not available outside of functions
backend = __opts__.get('backend', False)
if not backend and __opts__.get('requests_lib', False):
salt.utils.warn_until('Oxygen', '"requests_lib:True" has been replaced by "backend:requests", '
'please change your config')
if not backend:
backend = 'requests'
if backend == 'requests':
@ -148,9 +143,7 @@ def absent(name, directory_id=None):
'''
# Because __opts__ is not available outside of functions
backend = __opts__.get('backend', False)
if not backend and __opts__.get('requests_lib', False):
salt.utils.warn_until('Oxygen', '"requests_lib:True" has been replaced by "backend:requests", '
'please change your config')
if not backend:
backend = 'requests'
if backend == 'requests':

View File

@ -121,7 +121,6 @@ def query(url,
port=80,
opts=None,
backend=None,
requests_lib=None,
ca_bundle=None,
verify_ssl=None,
cert=None,
@ -154,18 +153,7 @@ def query(url,
opts = {}
if not backend:
if requests_lib is not None or 'requests_lib' in opts:
salt.utils.warn_until('Oxygen', '"requests_lib:True" has been replaced by "backend:requests", '
'please change your config')
# beware the named arg above
if 'backend' in opts:
backend = opts['backend']
elif requests_lib or opts.get('requests_lib', False):
backend = 'requests'
else:
backend = 'tornado'
else:
backend = opts.get('backend', 'tornado')
backend = opts.get('backend', 'tornado')
if backend == 'requests':
if HAS_REQUESTS is False: