Merge pull request #7607 from s0undt3ch/features/named-salt-versions

Fix remaining test cases and some minor fixes for named versions support
This commit is contained in:
Pedro Algarvio 2013-10-04 05:39:50 -07:00
commit 4c15422828
12 changed files with 68 additions and 48 deletions

View File

@ -578,7 +578,7 @@ def minion_config(path,
'Helium', 'Helium',
'The functionality behind the \'check_dns\' keyword argument is ' 'The functionality behind the \'check_dns\' keyword argument is '
'no longer required, as such, it became unnecessary and is now ' 'no longer required, as such, it became unnecessary and is now '
'deprecated. \'check_dns\' will be removed {version}.' 'deprecated. \'check_dns\' will be removed in Salt {version}.'
) )
if defaults is None: if defaults is None:
defaults = DEFAULT_MINION_OPTS defaults = DEFAULT_MINION_OPTS
@ -772,7 +772,7 @@ def apply_minion_config(overrides=None, defaults=None, check_dns=None):
'Helium', 'Helium',
'The functionality behind the \'check_dns\' keyword argument is ' 'The functionality behind the \'check_dns\' keyword argument is '
'no longer required, as such, it became unnecessary and is now ' 'no longer required, as such, it became unnecessary and is now '
'deprecated. \'check_dns\' will be removed {version}.' 'deprecated. \'check_dns\' will be removed in Salt {version}.'
) )
if defaults is None: if defaults is None:

View File

@ -146,7 +146,8 @@ def latest_version(*names, **kwargs):
salt.utils.warn_until( salt.utils.warn_until(
'Hydrogen', 'Hydrogen',
'The \'repo\' argument to apt.latest_version is deprecated, and ' 'The \'repo\' argument to apt.latest_version is deprecated, and '
'will be removed in {version}. Please use \'fromrepo\' instead.' 'will be removed in Salt {version}. Please use \'fromrepo\' '
'instead.'
) )
fromrepo = _get_repo(**kwargs) fromrepo = _get_repo(**kwargs)
kwargs.pop('fromrepo', None) kwargs.pop('fromrepo', None)

View File

@ -787,7 +787,7 @@ def script(source,
salt.utils.warn_until( salt.utils.warn_until(
'Helium', 'Helium',
'Passing a salt environment should be done using \'__env__\' not ' 'Passing a salt environment should be done using \'__env__\' not '
'\'env\'.' '\'env\'. This functionality will be removed in Salt {version}.'
) )
# Backwards compatibility # Backwards compatibility
__env__ = env __env__ = env

View File

@ -250,7 +250,7 @@ def install(pkgs=None,
salt.utils.warn_until( salt.utils.warn_until(
'Hydrogen', 'Hydrogen',
'The \'runas\' argument to pip.install is deprecated, and will be ' 'The \'runas\' argument to pip.install is deprecated, and will be '
'removed in {version}. Please use \'user\' instead.' 'removed in Salt {version}. Please use \'user\' instead.'
) )
# "There can only be one" # "There can only be one"
@ -561,7 +561,7 @@ def uninstall(pkgs=None,
salt.utils.warn_until( salt.utils.warn_until(
'Hydrogen', 'Hydrogen',
'The \'runas\' argument to pip.install is deprecated, and will be ' 'The \'runas\' argument to pip.install is deprecated, and will be '
'removed in {version}. Please use \'user\' instead.' 'removed in Salt {version}. Please use \'user\' instead.'
) )
# "There can only be one" # "There can only be one"
@ -685,7 +685,7 @@ def freeze(bin_env=None,
salt.utils.warn_until( salt.utils.warn_until(
'Hydrogen', 'Hydrogen',
'The \'runas\' argument to pip.install is deprecated, and will be ' 'The \'runas\' argument to pip.install is deprecated, and will be '
'removed in {version}. Please use \'user\' instead.' 'removed in Salt {version}. Please use \'user\' instead.'
) )
# "There can only be one" # "There can only be one"
@ -737,7 +737,7 @@ def list_(prefix=None,
salt.utils.warn_until( salt.utils.warn_until(
'Hydrogen', 'Hydrogen',
'The \'runas\' argument to pip.install is deprecated, and will be ' 'The \'runas\' argument to pip.install is deprecated, and will be '
'removed in {version}. Please use \'user\' instead.' 'removed in Salt {version}. Please use \'user\' instead.'
) )
# "There can only be one" # "There can only be one"

View File

@ -93,7 +93,8 @@ def create(path,
'Helium', 'Helium',
'\'no_site_packages\' has been deprecated. Please start using ' '\'no_site_packages\' has been deprecated. Please start using '
'\'system_site_packages=False\' which means exactly the same ' '\'system_site_packages=False\' which means exactly the same '
'as \'no_site_packages=True\'' 'as \'no_site_packages=True\'. This warning and respective '
'workaround will be removed in Salt {version}'
) )
if no_site_packages is True and system_site_packages is True: if no_site_packages is True and system_site_packages is True:

View File

@ -639,7 +639,7 @@ def script(name,
if isinstance(env, string_types): if isinstance(env, string_types):
msg = ( msg = (
'Passing a salt environment should be done using \'__env__\' not ' 'Passing a salt environment should be done using \'__env__\' not '
'\'env\'. This warning will go away in salt {version} and this ' '\'env\'. This warning will go away in Salt {version} and this '
'will be the default and expected behaviour. Please update your ' 'will be the default and expected behaviour. Please update your '
'state files.' 'state files.'
) )

View File

@ -24,6 +24,7 @@ import logging
# Import salt libs # Import salt libs
import salt.utils import salt.utils
from salt.version import SaltStackVersion as _SaltStackVersion
from salt.exceptions import CommandExecutionError, CommandNotFoundError from salt.exceptions import CommandExecutionError, CommandNotFoundError
# Import 3rd-party libs # Import 3rd-party libs
@ -149,9 +150,14 @@ def installed(name,
if repo is not None: if repo is not None:
msg = ('The \'repo\' argument to pip.installed is deprecated and will ' msg = ('The \'repo\' argument to pip.installed is deprecated and will '
'be removed in {version}. Please use \'name\' instead. The ' 'be removed in Salt {version}. Please use \'name\' instead. '
'current value for name, {0!r} will be replaced by the value ' 'The current value for name, {0!r} will be replaced by the '
'of repo, {1!r}'.format(name, repo)) 'value of repo, {1!r}'.format(
name,
repo,
version=_SaltStackVersion.from_name(
'Hydrogen').formatted_version
))
salt.utils.warn_until('Hydrogen', msg) salt.utils.warn_until('Hydrogen', msg)
ret.setdefault('warnings', []).append(msg) ret.setdefault('warnings', []).append(msg)
name = repo name = repo
@ -208,10 +214,12 @@ def installed(name,
if runas is not None: if runas is not None:
# The user is using a deprecated argument, warn! # The user is using a deprecated argument, warn!
msg = ( msg = ('The \'runas\' argument to pip.installed is deprecated, and '
'The \'runas\' argument to pip.installed is deprecated, and will ' 'will be removed in Salt {version}. Please use \'user\' '
'be removed in {version}. Please use \'user\' instead.' 'instead.'.format(
) version=_SaltStackVersion.from_name(
'Hydrogen').formatted_version
))
salt.utils.warn_until('Hydrogen', msg) salt.utils.warn_until('Hydrogen', msg)
ret.setdefault('warnings', []).append(msg) ret.setdefault('warnings', []).append(msg)
@ -397,10 +405,12 @@ def removed(name,
if runas is not None: if runas is not None:
# The user is using a deprecated argument, warn! # The user is using a deprecated argument, warn!
msg = ( msg = ('The \'runas\' argument to pip.installed is deprecated, and '
'The \'runas\' argument to pip.installed is deprecated, and will ' 'will be removed in Salt {version}. Please use \'user\' '
'be removed in {version}. Please use \'user\' instead.' 'instead.'.format(
) version=_SaltStackVersion.from_name(
'Hydrogen').formatted_version
))
salt.utils.warn_until('Hydrogen', msg) salt.utils.warn_until('Hydrogen', msg)
ret.setdefault('warnings', []).append(msg) ret.setdefault('warnings', []).append(msg)

View File

@ -1658,7 +1658,7 @@ def memoize(func):
'Helium', 'Helium',
'The \'memoize\' decorator was moved to \'salt.utils.decorators\', ' 'The \'memoize\' decorator was moved to \'salt.utils.decorators\', '
'please start importing it from there. This warning and wrapper ' 'please start importing it from there. This warning and wrapper '
'will be removed on salt > {version}.', 'will be removed in Salt {version}.',
stacklevel=3 stacklevel=3
) )

View File

@ -26,6 +26,7 @@ import salt.minion
import salt.utils import salt.utils
import integration import integration
from salt import config as sconfig, version as salt_version from salt import config as sconfig, version as salt_version
from salt.version import SaltStackVersion
class ConfigTestCase(TestCase): class ConfigTestCase(TestCase):
@ -298,7 +299,8 @@ class ConfigTestCase(TestCase):
self.assertEquals(syndic_opts['_minion_conf_file'], syndic_conf_path) self.assertEquals(syndic_opts['_minion_conf_file'], syndic_conf_path)
def test_check_dns_deprecation_warning(self): def test_check_dns_deprecation_warning(self):
if salt_version.__version_info__ >= 'Helium': helium_version = SaltStackVersion.from_name('Helium')
if salt_version.__version_info__ >= helium_version:
raise AssertionError( raise AssertionError(
'Failing this test on purpose! Please delete this test case, ' 'Failing this test on purpose! Please delete this test case, '
'the \'check_dns\' keyword argument and the deprecation ' 'the \'check_dns\' keyword argument and the deprecation '
@ -316,8 +318,9 @@ class ConfigTestCase(TestCase):
self.assertEqual( self.assertEqual(
'The functionality behind the \'check_dns\' keyword argument ' 'The functionality behind the \'check_dns\' keyword argument '
'is no longer required, as such, it became unnecessary and is ' 'is no longer required, as such, it became unnecessary and is '
'now deprecated. \'check_dns\' will be removed in salt > ' 'now deprecated. \'check_dns\' will be removed in Salt '
'0.18.0', str(w[-1].message) '{0}.'.format(helium_version.formatted_version),
str(w[-1].message)
) )
with warnings.catch_warnings(record=True) as w: with warnings.catch_warnings(record=True) as w:
@ -327,8 +330,9 @@ class ConfigTestCase(TestCase):
self.assertEqual( self.assertEqual(
'The functionality behind the \'check_dns\' keyword argument ' 'The functionality behind the \'check_dns\' keyword argument '
'is no longer required, as such, it became unnecessary and is ' 'is no longer required, as such, it became unnecessary and is '
'now deprecated. \'check_dns\' will be removed in salt > ' 'now deprecated. \'check_dns\' will be removed in Salt '
'0.18.0', str(w[-1].message) '{0}.'.format(helium_version.formatted_version),
str(w[-1].message)
) )
with warnings.catch_warnings(record=True) as w: with warnings.catch_warnings(record=True) as w:
@ -336,8 +340,9 @@ class ConfigTestCase(TestCase):
self.assertEqual( self.assertEqual(
'The functionality behind the \'check_dns\' keyword argument ' 'The functionality behind the \'check_dns\' keyword argument '
'is no longer required, as such, it became unnecessary and is ' 'is no longer required, as such, it became unnecessary and is '
'now deprecated. \'check_dns\' will be removed in salt > ' 'now deprecated. \'check_dns\' will be removed in Salt '
'0.18.0', str(w[-1].message) '{0}.'.format(helium_version.formatted_version),
str(w[-1].message)
) )
with warnings.catch_warnings(record=True) as w: with warnings.catch_warnings(record=True) as w:
@ -347,8 +352,9 @@ class ConfigTestCase(TestCase):
self.assertEqual( self.assertEqual(
'The functionality behind the \'check_dns\' keyword argument ' 'The functionality behind the \'check_dns\' keyword argument '
'is no longer required, as such, it became unnecessary and is ' 'is no longer required, as such, it became unnecessary and is '
'now deprecated. \'check_dns\' will be removed in salt > ' 'now deprecated. \'check_dns\' will be removed in Salt '
'0.18.0', str(w[-1].message) '{0}.'.format(helium_version.formatted_version),
str(w[-1].message)
) )

View File

@ -885,8 +885,8 @@ class PipTestCase(TestCase):
pip.install('pep8', runas='me!') pip.install('pep8', runas='me!')
self.assertEqual( self.assertEqual(
'The \'runas\' argument to pip.install is deprecated, and ' 'The \'runas\' argument to pip.install is deprecated, and '
'will be removed in 0.18.0. Please use \'user\' instead.', 'will be removed in Salt Hydrogen (Unreleased). Please '
str(w[-1].message) 'use \'user\' instead.', str(w[-1].message)
) )
def test_uninstall_deprecated_runas_triggers_warning(self): def test_uninstall_deprecated_runas_triggers_warning(self):
@ -900,8 +900,8 @@ class PipTestCase(TestCase):
pip.uninstall('pep8', runas='me!') pip.uninstall('pep8', runas='me!')
self.assertEqual( self.assertEqual(
'The \'runas\' argument to pip.install is deprecated, and ' 'The \'runas\' argument to pip.install is deprecated, and '
'will be removed in 0.18.0. Please use \'user\' instead.', 'will be removed in Salt Hydrogen (Unreleased). Please '
str(w[-1].message) 'use \'user\' instead.', str(w[-1].message)
) )
def test_freeze_deprecated_runas_triggers_warning(self): def test_freeze_deprecated_runas_triggers_warning(self):
@ -915,8 +915,8 @@ class PipTestCase(TestCase):
pip.freeze('/tmp/pip-env', runas='me!') pip.freeze('/tmp/pip-env', runas='me!')
self.assertEqual( self.assertEqual(
'The \'runas\' argument to pip.install is deprecated, and ' 'The \'runas\' argument to pip.install is deprecated, and '
'will be removed in 0.18.0. Please use \'user\' instead.', 'will be removed in Salt Hydrogen (Unreleased). Please '
str(w[-1].message) 'use \'user\' instead.', str(w[-1].message)
) )
def test_list_deprecated_runas_triggers_warning(self): def test_list_deprecated_runas_triggers_warning(self):
@ -930,8 +930,8 @@ class PipTestCase(TestCase):
pip.list_('blah', runas='me!') pip.list_('blah', runas='me!')
self.assertEqual( self.assertEqual(
'The \'runas\' argument to pip.install is deprecated, and ' 'The \'runas\' argument to pip.install is deprecated, and '
'will be removed in 0.18.0. Please use \'user\' instead.', 'will be removed in Salt Hydrogen (Unreleased). Please '
str(w[-1].message) 'use \'user\' instead.', str(w[-1].message)
) )
def test_install_user_and_runas_raises_exception(self): def test_install_user_and_runas_raises_exception(self):

View File

@ -177,7 +177,9 @@ class VirtualenvTestCase(TestCase):
self.assertEqual( self.assertEqual(
'\'no_site_packages\' has been deprecated. Please ' '\'no_site_packages\' has been deprecated. Please '
'start using \'system_site_packages=False\' which ' 'start using \'system_site_packages=False\' which '
'means exactly the same as \'no_site_packages=True\'', 'means exactly the same as \'no_site_packages=True\'. '
'This warning and respective workaround will be removed '
'in Salt Helium (Unreleased)',
str(w[-1].message) str(w[-1].message)
) )

View File

@ -48,16 +48,16 @@ class PipStateTest(TestCase, integration.SaltReturnAssertsMixIn):
ret = pip_state.installed('pep8', runas='me!') ret = pip_state.installed('pep8', runas='me!')
self.assertEqual( self.assertEqual(
'The \'runas\' argument to pip.installed is deprecated, ' 'The \'runas\' argument to pip.installed is deprecated, '
'and will be removed in 0.18.0. Please use \'user\' ' 'and will be removed in Salt Hydrogen (Unreleased). '
'instead.', str(w[-1].message) 'Please use \'user\' instead.', str(w[-1].message)
) )
self.assertSaltTrueReturn({'testsuite': ret}) self.assertSaltTrueReturn({'testsuite': ret})
# Is the state returning a warnings key with the deprecation # Is the state returning a warnings key with the deprecation
# message? # message?
self.assertInSalStatetWarning( self.assertInSalStatetWarning(
'The \'runas\' argument to pip.installed is deprecated, ' 'The \'runas\' argument to pip.installed is deprecated, '
'and will be removed in 0.18.0. Please use \'user\' ' 'and will be removed in Salt Hydrogen (Unreleased). '
'instead.', {'testsuite': ret} 'Please use \'user\' instead.', {'testsuite': ret}
) )
def test_installed_runas_and_user_raises_exception(self): def test_installed_runas_and_user_raises_exception(self):
@ -86,16 +86,16 @@ class PipStateTest(TestCase, integration.SaltReturnAssertsMixIn):
ret = pip_state.removed('pep8', runas='me!') ret = pip_state.removed('pep8', runas='me!')
self.assertEqual( self.assertEqual(
'The \'runas\' argument to pip.installed is deprecated, ' 'The \'runas\' argument to pip.installed is deprecated, '
'and will be removed in 0.18.0. Please use \'user\' ' 'and will be removed in Salt Hydrogen (Unreleased). '
'instead.', str(w[-1].message) 'Please use \'user\' instead.', str(w[-1].message)
) )
self.assertSaltTrueReturn({'testsuite': ret}) self.assertSaltTrueReturn({'testsuite': ret})
# Is the state returning a warnings key with the deprecation # Is the state returning a warnings key with the deprecation
# message? # message?
self.assertInSalStatetWarning( self.assertInSalStatetWarning(
'The \'runas\' argument to pip.installed is deprecated, ' 'The \'runas\' argument to pip.installed is deprecated, '
'and will be removed in 0.18.0. Please use \'user\' ' 'and will be removed in Salt Hydrogen (Unreleased). '
'instead.', {'testsuite': ret} 'Please use \'user\' instead.', {'testsuite': ret}
) )
def test_removed_runas_and_user_raises_exception(self): def test_removed_runas_and_user_raises_exception(self):