Update old utils paths to use new paths

This commit is contained in:
rallytime 2018-08-28 11:41:38 -04:00
parent ac406c49a7
commit ab6cc1c741
No known key found for this signature in database
GPG key ID: E8F1A4B90D0DEA19
5 changed files with 9 additions and 7 deletions

View file

@ -69,7 +69,7 @@ def grains(tgt=None, tgt_type='glob', **kwargs):
if tgt is None:
# Change ``tgt=None`` to ``tgt`` (mandatory kwarg) in Salt Sodium.
# This behavior was changed in PR #45588 to fix Issue #45489.
salt.utils.warn_until(
salt.utils.versions.warn_until(
'Sodium',
'Detected missing \'tgt\' option. Cached grains will not be returned '
'without a specified \'tgt\'. This option will be required starting in '

View file

@ -17,6 +17,7 @@ from tests.support.helpers import destructiveTest
# Import salt libs
import salt.utils.files
import salt.utils.path
import salt.utils.platform
import salt.utils.stringutils
# Import 3rd party libs
@ -112,7 +113,7 @@ class ArchiveTest(ModuleCase):
def normdir(path):
normdir = os.path.normcase(os.path.abspath(path))
if salt.utils.is_windows():
if salt.utils.platform.is_windows():
# Remove the drive portion of path
if len(normdir) >= 2 and normdir[1] == ':':
normdir = normdir.split(':', 1)[1]

View file

@ -2269,7 +2269,7 @@ class FileTest(ModuleCase, SaltReturnAssertsMixin):
if salt.utils.platform.is_windows():
import subprocess
import win32api
p = subprocess.Popen(salt.utils.to_str('type {}'.format(win32api.GetShortPathName(test_file))),
p = subprocess.Popen(salt.utils.stringutils.to_str('type {}'.format(win32api.GetShortPathName(test_file))),
shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p.poll()
out = p.stdout.read()

View file

@ -267,7 +267,7 @@ class ShellTestCase(TestCase, AdaptedConfigurationTestCaseMixin):
if not os.path.isfile(script_path):
return False
if salt.utils.is_windows():
if salt.utils.platform.is_windows():
cmd = 'python '
else:
cmd = 'PYTHONPATH='

View file

@ -59,6 +59,7 @@ from tests.support.paths import FILES, TMP
# Import Salt libs
import salt.utils.files
import salt.utils.platform
import salt.utils.stringutils
if salt.utils.platform.is_windows():
import salt.utils.win_functions
@ -1614,11 +1615,11 @@ def dedent(text, linesep=os.linesep):
'''
A wrapper around textwrap.dedent that also sets line endings.
'''
linesep = salt.utils.to_unicode(linesep)
unicode_text = textwrap.dedent(salt.utils.to_unicode(text))
linesep = salt.utils.stringutils.to_unicode(linesep)
unicode_text = textwrap.dedent(salt.utils.stringutils.to_unicode(text))
clean_text = linesep.join(unicode_text.splitlines())
if unicode_text.endswith(u'\n'):
clean_text += linesep
if not isinstance(text, six.text_type):
return salt.utils.to_bytes(clean_text)
return salt.utils.stringutils.to_bytes(clean_text)
return clean_text