Merge pull request #40510 from twangboy/deprecate_win_update

Add deprecation warnings to win_update state and execution modules
This commit is contained in:
Nicole Thomas 2017-04-05 11:47:56 -06:00 committed by GitHub
commit 59db716817
3 changed files with 32 additions and 2 deletions

View File

@ -2,6 +2,9 @@
'''
Module for running windows updates.
This module is being deprecated and will be removed in Salt Fluorine. Please use
the ``win_wua`` module instead.
:depends: - win32com
- win32con
- win32api
@ -83,6 +86,11 @@ def __virtual__():
Only works on Windows systems
'''
if salt.utils.is_windows() and HAS_DEPENDENCIES:
salt.utils.warn_until(
'Fluorine',
'The \'win_update\' module is being deprecated and will be removed '
'in Salt {version}. Please use the \'win_wua\' module instead.'
)
return True
return (False, "Module win_update: module has failed dependencies or is not on Windows client")

View File

@ -3,6 +3,9 @@
Management of the windows update agent
======================================
This module is being deprecated and will be removed in Salt Fluorine. Please use
the ``win_wua`` state module instead.
.. versionadded:: 2014.7.0
Set windows updates to run by category. Default behavior is to install
@ -454,10 +457,16 @@ def installed(name, categories=None, skips=None, retries=10):
Number of retries to make before giving up. This is total, not per
step.
'''
ret = {'name': name,
'result': True,
'changes': {},
'comment': ''}
deprecation_msg = 'The \'win_update\' module is deprecated, and will be ' \
'removed in Salt Fluorine. Please use the \'win_wua\' ' \
'module instead.'
salt.utils.warn_until('Fluorine', deprecation_msg)
ret.setdefault('warnings', []).append(deprecation_msg)
if not categories:
categories = [name]
log.debug('categories to search for are: {0}'.format(categories))
@ -536,6 +545,13 @@ def downloaded(name, categories=None, skips=None, retries=10):
'result': True,
'changes': {},
'comment': ''}
deprecation_msg = 'The \'win_update\' module is deprecated, and will be ' \
'removed in Salt Fluorine. Please use the \'win_wua\' ' \
'module instead.'
salt.utils.warn_until('Fluorine', deprecation_msg)
ret.setdefault('warnings', []).append(deprecation_msg)
if not categories:
categories = [name]
log.debug('categories to search for are: {0}'.format(categories))

View File

@ -72,7 +72,10 @@ class WinUpdateTestCase(TestCase):
ret = {'name': 'salt',
'changes': {},
'result': False,
'comment': ''}
'comment': '',
'warnings': ["The 'win_update' module is deprecated, and will "
"be removed in Salt Fluorine. Please use the "
"'win_wua' module instead."]}
mock = MagicMock(side_effect=[['Saltstack', False, 5],
['Saltstack', True, 5],
@ -105,7 +108,10 @@ class WinUpdateTestCase(TestCase):
ret = {'name': 'salt',
'changes': {},
'result': False,
'comment': ''}
'comment': '',
'warnings': ["The 'win_update' module is deprecated, and will "
"be removed in Salt Fluorine. Please use the "
"'win_wua' module instead."]}
mock = MagicMock(side_effect=[['Saltstack', False, 5],
['Saltstack', True, 5],