Update old utils paths to new paths

This commit is contained in:
rallytime 2018-03-15 17:31:29 -04:00
parent 8d1e1e7f94
commit 8886b61576
No known key found for this signature in database
GPG key ID: E8F1A4B90D0DEA19
5 changed files with 15 additions and 10 deletions

View file

@ -12,6 +12,7 @@ import re
# Import salt libs
import salt.utils.path
import salt.utils.files
import salt.utils.stringutils
import salt.utils.versions
log = logging.getLogger(__name__)
@ -128,7 +129,7 @@ def set_(package, question, type, value, *extra):
fd_, fname = salt.utils.files.mkstemp(prefix="salt-", close_fd=False)
line = "{0} {1} {2} {3}".format(package, question, type, value)
os.write(fd_, salt.utils.to_bytes(line))
os.write(fd_, salt.utils.stringutils.to_bytes(line))
os.close(fd_)
_set_file(fname)

View file

@ -51,6 +51,7 @@ from salt.ext import six
import salt.utils.files
import salt.utils.json
import salt.utils.stringutils
import salt.utils.versions
import salt.utils.yaml
# pylint: disable=import-error
@ -476,7 +477,7 @@ def create_stack(name=None, template_file=None, environment=None,
'''
if environment is None and enviroment is not None:
salt.utils.warn_until('Neon', (
salt.utils.versions.warn_until('Neon', (
"Please use the 'environment' parameter instead of the misspelled 'enviroment' "
"parameter which will be removed in Salt Neon."
))
@ -671,7 +672,7 @@ def update_stack(name=None, template_file=None, environment=None,
'''
if environment is None and enviroment is not None:
salt.utils.warn_until('Neon', (
salt.utils.versions.warn_until('Neon', (
"Please use the 'environment' parameter instead of the misspelled 'enviroment' "
"parameter which will be removed in Salt Neon."
))

View file

@ -49,6 +49,7 @@ import salt.exceptions
import salt.utils.files
import salt.utils.json
import salt.utils.stringutils
import salt.utils.versions
import salt.utils.yaml
# Import 3rd-party libs
@ -136,7 +137,7 @@ def deployed(name, template=None, environment=None, params=None, poll=5,
'''
if environment is None and 'enviroment' in connection_args:
salt.utils.warn_until('Neon', (
salt.utils.versions.warn_until('Neon', (
"Please use the 'environment' parameter instead of the misspelled 'enviroment' "
"parameter which will be removed in Salt Neon."
))

View file

@ -33,9 +33,11 @@ from tests.support.helpers import (
from tests.support.mixins import SaltReturnAssertsMixin
# Import Salt libs
import salt.utils.data
import salt.utils.files
import salt.utils.path
import salt.utils.platform
import salt.utils.stringutils
HAS_PWD = True
try:
@ -2592,13 +2594,13 @@ class BlockreplaceTest(ModuleCase, SaltReturnAssertsMixin):
@staticmethod
def _write(dest, content):
with salt.utils.fopen(dest, 'wb') as fp_:
fp_.write(salt.utils.to_bytes(content))
with salt.utils.files.fopen(dest, 'wb') as fp_:
fp_.write(salt.utils.stringutils.to_bytes(content))
@staticmethod
def _read(src):
with salt.utils.fopen(src, 'rb') as fp_:
return salt.utils.to_unicode(fp_.read())
with salt.utils.files.fopen(src, 'rb') as fp_:
return salt.utils.stringutils.to_unicode(fp_.read())
@with_tempfile
def test_prepend(self, name):

View file

@ -18,7 +18,7 @@ from tests.support.runtests import RUNTIME_VARS
from tests.support.unit import TestCase
# Import Salt libs
import salt.utils
import salt.utils.files
import salt.returners.highstate_return as highstate
log = logging.getLogger(__name__)
@ -110,5 +110,5 @@ class HighstateReturnerTestCase(TestCase, LoaderModuleMockMixin):
}
]
highstate.returner(ret)
with salt.utils.fopen(self.output_file) as fh_:
with salt.utils.files.fopen(self.output_file) as fh_:
self.assertEqual(json.load(fh_), expected)