mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Update old utils paths to use new paths
This commit is contained in:
parent
ac406c49a7
commit
ab6cc1c741
5 changed files with 9 additions and 7 deletions
|
@ -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 '
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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='
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue