Merge pull request #47727 from Ch3LL/spelling

Fix salt.utils.versions.warn_until spelling
This commit is contained in:
Nicole Thomas 2018-05-21 09:40:59 -04:00 committed by GitHub
commit 3614d3d83a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 47 additions and 9 deletions

View File

@ -35,7 +35,7 @@ In case both are provided the `file` entry is preferred.
.. warning::
Configuration options will change in Flourine. All options above will be replaced by:
Configuration options will change in Fluorine. All options above will be replaced by:
- kubernetes.kubeconfig or kubernetes.kubeconfig-data
- kubernetes.context

View File

@ -630,7 +630,7 @@ def install(pkgs=None, # pylint: disable=R0912,R0913,R0914
'''
if 'no_chown' in kwargs:
salt.utils.versions.warn_until(
'Flourine',
'Fluorine',
'The no_chown argument has been deprecated and is no longer used. '
'Its functionality was removed in Boron.')
kwargs.pop('no_chown')

View File

@ -8,7 +8,7 @@ salt.modules.kubernetes for more information.
.. warning::
Configuration options will change in Flourine.
Configuration options will change in Fluorine.
The kubernetes module is used to manage different kubernetes resources.

View File

@ -586,7 +586,7 @@ def installed(name,
'''
if 'no_chown' in kwargs:
salt.utils.versions.warn_until(
'Flourine',
'Fluorine',
'The no_chown argument has been deprecated and is no longer used. '
'Its functionality was removed in Boron.')
kwargs.pop('no_chown')

View File

@ -137,7 +137,7 @@ def managed(name,
'''
if 'no_chown' in kwargs:
salt.utils.versions.warn_until(
'Flourine',
'Fluorine',
'The no_chown argument has been deprecated and is no longer used. '
'Its functionality was removed in Boron.')
kwargs.pop('no_chown')

View File

@ -115,10 +115,10 @@ def installed(name,
'''
if 'force' in kwargs:
salt.utils.versions.warn_until(
'Flourine',
'Fluorine',
'Parameter \'force\' has been detected in the argument list. This'
'parameter is no longer used and has been replaced by \'recurse\''
'as of Salt 2018.3.0. This warning will be removed in Salt Flourine.'
'as of Salt 2018.3.0. This warning will be removed in Salt Fluorine.'
)
kwargs.pop('force')

View File

@ -2733,9 +2733,9 @@ def cache_nodes_ip(opts, base=None):
addresses. Returns a dict.
'''
salt.utils.versions.warn_until(
'Flourine',
'Fluorine',
'This function is incomplete and non-functional '
'and will be removed in Salt Flourine.'
'and will be removed in Salt Fluorine.'
)
if base is None:
base = opts['cachedir']

View File

@ -10,15 +10,19 @@
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import os
import sys
import warnings
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import TestCase, skipIf
from tests.support.mock import patch, NO_MOCK, NO_MOCK_REASON
# Import Salt libs
import salt.modules.cmdmod
import salt.version
import salt.utils.platform
import salt.utils.versions
from salt.utils.versions import LooseVersion, StrictVersion
@ -95,6 +99,40 @@ class VersionTestCase(TestCase):
'cmp(%s, %s) should be %s, got %s' %
(v1, v2, wanted, res))
@skipIf(not salt.utils.platform.is_linux(), 'only need to run on linux')
def test_spelling_version_name(self):
'''
check the spelling of the version name for the release
names in the salt.utils.versions.warn_until call
'''
salt_dir = integration.CODE_DIR
query = 'salt.utils.versions.warn_until'
names = salt.version.SaltStackVersion.NAMES
salt_dir += '/salt/'
cmd = 'grep -lr {0} -A 1 '.format(query) + salt_dir
grep_call = salt.modules.cmdmod.run_stdout(cmd=cmd).split(os.linesep)
for line in grep_call:
num_cmd = salt.modules.cmdmod.run_stdout('grep -c {0} {1}'.format(query, line))
ver_cmd = salt.modules.cmdmod.run_stdout('grep {0} {1} -A 1'.format(query, line))
if 'pyc' in line:
break
match = 0
for key in names:
if key in ver_cmd:
match = match + (ver_cmd.count(key))
if 'utils/__init__.py' in line:
# work around for utils/__init__.py because
# it includes the warn_utils function
match = match + 1
self.assertEqual(match, int(num_cmd), msg='The file: {0} has an '
'incorrect spelling for the release name in the warn_utils '
'call: {1}. Expecting one of these release names: '
'{2}'.format(line, ver_cmd, names))
class VersionFuncsTestCase(TestCase):