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
e740d3b208
commit
ea5c063237
6 changed files with 20 additions and 17 deletions
|
@ -55,7 +55,7 @@ def _ssh_state(chunks, st_kwargs,
|
|||
file_refs,
|
||||
__pillar__,
|
||||
st_kwargs['id_'])
|
||||
trans_tar_sum = salt.utils.get_hash(trans_tar, __opts__['hash_type'])
|
||||
trans_tar_sum = salt.utils.hashutils.get_hash(trans_tar, __opts__['hash_type'])
|
||||
cmd = 'state.pkg {0}/salt_state.tgz test={1} pkg_sum={2} hash_type={3}'.format(
|
||||
__opts__['thin_dir'],
|
||||
test,
|
||||
|
@ -80,7 +80,7 @@ def _ssh_state(chunks, st_kwargs,
|
|||
|
||||
# Read in the JSON data and return the data structure
|
||||
try:
|
||||
return json.loads(stdout, object_hook=salt.utils.decode_dict)
|
||||
return salt.utils.json.loads(stdout, object_hook=salt.utils.data.encode_dict)
|
||||
except Exception as e:
|
||||
log.error("JSON Render failed for: %s\n%s", stdout, stderr)
|
||||
log.error(str(e))
|
||||
|
|
|
@ -18,7 +18,8 @@ import re
|
|||
import logging
|
||||
|
||||
# Import Salt Libs
|
||||
import salt.utils
|
||||
import salt.utils.platform
|
||||
import salt.utils.versions
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -29,7 +30,7 @@ def __virtual__():
|
|||
'''
|
||||
Only work on Windows
|
||||
'''
|
||||
if not salt.utils.is_windows():
|
||||
if not salt.utils.platform.is_windows():
|
||||
return False, 'PowerCFG: Module only works on Windows'
|
||||
return __virtualname__
|
||||
|
||||
|
@ -73,7 +74,7 @@ def _set_powercfg_value(scheme, sub_group, setting_guid, power, value):
|
|||
'''
|
||||
Sets the AC/DC values of a setting with the given power for the given scheme
|
||||
'''
|
||||
salt.utils.warn_until(
|
||||
salt.utils.versions.warn_until(
|
||||
'Fluorine',
|
||||
'This function now expects the timeout value in minutes instead of '
|
||||
'seconds as stated in the documentation. This warning will be removed '
|
||||
|
|
|
@ -20,7 +20,8 @@ from __future__ import absolute_import, unicode_literals, print_function
|
|||
import logging
|
||||
|
||||
# Import Salt Libs
|
||||
import salt.utils
|
||||
import salt.utils.data
|
||||
import salt.utils.platform
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -31,7 +32,7 @@ def __virtual__():
|
|||
'''
|
||||
Only work on Windows
|
||||
'''
|
||||
if not salt.utils.is_windows():
|
||||
if not salt.utils.platform.is_windows():
|
||||
return False, 'PowerCFG: Module only works on Windows'
|
||||
return __virtualname__
|
||||
|
||||
|
@ -132,7 +133,7 @@ def set_timeout(name, value, power='ac', scheme=None):
|
|||
# Get the setting after the change
|
||||
new = __salt__['powercfg.get_{0}_timeout'.format(name)](scheme=scheme)
|
||||
|
||||
changes = salt.utils.compare_dicts(old, new)
|
||||
changes = salt.utils.data.compare_dicts(old, new)
|
||||
|
||||
if changes:
|
||||
ret['changes'] = {name: changes}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Import Python libs
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
import re
|
||||
|
||||
# Import Salt Testing libs
|
||||
|
@ -9,10 +9,10 @@ from tests.support.case import ModuleCase
|
|||
from tests.support.unit import skipIf
|
||||
|
||||
# Import Salt libs
|
||||
import salt.utils
|
||||
import salt.utils.platform
|
||||
|
||||
|
||||
@skipIf(not salt.utils.is_windows(), 'windows test only')
|
||||
@skipIf(not salt.utils.platform.is_windows(), 'windows test only')
|
||||
class WinIPTest(ModuleCase):
|
||||
'''
|
||||
Tests for salt.modules.win_ip
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Import Python libs
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
import os
|
||||
import textwrap
|
||||
|
||||
|
@ -12,12 +12,13 @@ from tests.support.helpers import destructiveTest
|
|||
from tests.support.runtests import RUNTIME_VARS
|
||||
|
||||
# Import Salt libs
|
||||
import salt.utils
|
||||
import salt.utils.files
|
||||
import salt.utils.platform
|
||||
|
||||
CURL = os.path.join(RUNTIME_VARS.FILES, 'file', 'base', 'win', 'repo-ng', 'curl.sls')
|
||||
|
||||
|
||||
@skipIf(not salt.utils.is_windows(), 'windows test only')
|
||||
@skipIf(not salt.utils.platform.is_windows(), 'windows test only')
|
||||
class WinPKGTest(ModuleCase):
|
||||
'''
|
||||
Tests for salt.modules.win_pkg. There are already
|
||||
|
@ -53,7 +54,7 @@ class WinPKGTest(ModuleCase):
|
|||
_check_pkg(pkgs)
|
||||
|
||||
# now add new sls
|
||||
with salt.utils.fopen(CURL, 'w') as fp_:
|
||||
with salt.utils.files.fopen(CURL, 'w') as fp_:
|
||||
fp_.write(textwrap.dedent('''
|
||||
curl:
|
||||
'7.46.0':
|
||||
|
|
|
@ -61,10 +61,10 @@ class TestFileState(TestCase, LoaderModuleMockMixin):
|
|||
|
||||
def tearDown(self):
|
||||
remove_dir = '/tmp/etc'
|
||||
if salt.utils.is_windows():
|
||||
if salt.utils.platform.is_windows():
|
||||
remove_dir = 'c:\\tmp\\etc'
|
||||
try:
|
||||
salt.utils.rm_rf(remove_dir)
|
||||
salt.utils.files.rm_rf(remove_dir)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue