mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Update old utils paths to new paths
This commit is contained in:
parent
2c052e34b3
commit
f26beffe48
5 changed files with 30 additions and 30 deletions
|
@ -49,10 +49,11 @@ import ctypes
|
|||
import time
|
||||
|
||||
# Import Salt libs
|
||||
from salt.exceptions import CommandExecutionError, SaltInvocationError
|
||||
import salt.utils.dictupdate as dictupdate
|
||||
import salt.utils.files
|
||||
import salt.utils.platform
|
||||
import salt.utils.dictupdate as dictupdate
|
||||
from salt.exceptions import CommandExecutionError, SaltInvocationError
|
||||
import salt.utils.stringutils
|
||||
|
||||
# Import 3rd-party libs
|
||||
from salt.ext import six
|
||||
|
@ -4082,7 +4083,7 @@ def _write_regpol_data(data_to_write,
|
|||
gpt_ini_data = ''
|
||||
if os.path.exists(gpt_ini_path):
|
||||
with salt.utils.files.fopen(gpt_ini_path, 'rb') as gpt_file:
|
||||
gpt_ini_data = salt.utils.to_str(gpt_file.read())
|
||||
gpt_ini_data = salt.utils.stringutils.to_str(gpt_file.read())
|
||||
if not _regexSearchRegPolData(r'\[General\]\r\n', gpt_ini_data):
|
||||
gpt_ini_data = '[General]\r\n' + gpt_ini_data
|
||||
if _regexSearchRegPolData(r'{0}='.format(re.escape(gpt_extension)), gpt_ini_data):
|
||||
|
@ -4137,7 +4138,7 @@ def _write_regpol_data(data_to_write,
|
|||
gpt_ini_data[general_location.end():])
|
||||
if gpt_ini_data:
|
||||
with salt.utils.files.fopen(gpt_ini_path, 'wb') as gpt_file:
|
||||
gpt_file.write(salt.utils.to_bytes(gpt_ini_data))
|
||||
gpt_file.write(salt.utils.stringutils.to_bytes(gpt_ini_data))
|
||||
except Exception as e:
|
||||
msg = 'An error occurred attempting to write to {0}, the exception was {1}'.format(
|
||||
gpt_ini_path, e)
|
||||
|
|
|
@ -4,20 +4,20 @@ This module is used to manage Wordpress installations
|
|||
|
||||
:depends: wp binary from http://wp-cli.org/
|
||||
'''
|
||||
from __future__ import absolute_import
|
||||
|
||||
# Import Python Modules
|
||||
from __future__ import absolute_import
|
||||
import collections
|
||||
|
||||
# Import Salt Modules
|
||||
import salt.utils
|
||||
from salt.ext.six.moves import map
|
||||
import salt.utils.path
|
||||
|
||||
Plugin = collections.namedtuple('Plugin', 'name status update versino')
|
||||
|
||||
|
||||
def __virtual__():
|
||||
if salt.utils.which('wp'):
|
||||
if salt.utils.path.which('wp'):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ from tests.support.case import ModuleCase
|
|||
from tests.support.paths import TMP_PILLAR_TREE
|
||||
|
||||
# Import Salt Libs
|
||||
import salt.utils
|
||||
import salt.utils.files
|
||||
|
||||
|
||||
class SaltUtilModuleTest(ModuleCase):
|
||||
|
@ -175,18 +175,18 @@ class SaltUtilSyncPillarTest(ModuleCase):
|
|||
pre_pillar = self.run_function('pillar.raw')
|
||||
self.assertNotIn(pillar_key, pre_pillar.get(pillar_key, 'didnotwork'))
|
||||
|
||||
with salt.utils.fopen(os.path.join(TMP_PILLAR_TREE, 'add_pillar.sls'), 'w') as fp:
|
||||
with salt.utils.files.fopen(os.path.join(TMP_PILLAR_TREE, 'add_pillar.sls'), 'w') as fp:
|
||||
fp.write('{0}: itworked'.format(pillar_key))
|
||||
|
||||
with salt.utils.fopen(os.path.join(TMP_PILLAR_TREE, 'top.sls'), 'w') as fp:
|
||||
with salt.utils.files.fopen(os.path.join(TMP_PILLAR_TREE, 'top.sls'), 'w') as fp:
|
||||
fp.write(textwrap.dedent('''\
|
||||
base:
|
||||
'*':
|
||||
- add_pillar
|
||||
'''))
|
||||
|
||||
pillar_refresh = self.run_function('saltutil.refresh_pillar')
|
||||
wait = self.run_function('test.sleep', [1])
|
||||
self.run_function('saltutil.refresh_pillar')
|
||||
self.run_function('test.sleep', [1])
|
||||
|
||||
post_pillar = self.run_function('pillar.raw')
|
||||
self.assertIn(pillar_key, post_pillar.get(pillar_key, 'didnotwork'))
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Import python libs
|
||||
# Import Python libs
|
||||
from __future__ import absolute_import
|
||||
|
||||
# Import Salt Testing libs
|
||||
|
@ -8,7 +8,7 @@ from tests.support.case import ModuleCase
|
|||
from tests.support.helpers import destructiveTest
|
||||
|
||||
# Import Salt libs
|
||||
import salt.utils
|
||||
import salt.utils.path
|
||||
|
||||
|
||||
@destructiveTest
|
||||
|
@ -26,7 +26,7 @@ class ServiceModuleTest(ModuleCase):
|
|||
self.service_name = 'systemd-journald'
|
||||
cmd_name = 'systemctl'
|
||||
|
||||
if salt.utils.which(cmd_name) is None:
|
||||
if salt.utils.path.which(cmd_name) is None:
|
||||
self.skipTest('{0} is not installed'.format(cmd_name))
|
||||
|
||||
def test_service_status_running(self):
|
||||
|
@ -34,8 +34,7 @@ class ServiceModuleTest(ModuleCase):
|
|||
test service.status execution module
|
||||
when service is running
|
||||
'''
|
||||
start_service = self.run_function('service.start', [self.service_name])
|
||||
|
||||
self.run_function('service.start', [self.service_name])
|
||||
check_service = self.run_function('service.status', [self.service_name])
|
||||
self.assertTrue(check_service)
|
||||
|
||||
|
@ -44,7 +43,6 @@ class ServiceModuleTest(ModuleCase):
|
|||
test service.status execution module
|
||||
when service is dead
|
||||
'''
|
||||
stop_service = self.run_function('service.stop', [self.service_name])
|
||||
|
||||
self.run_function('service.stop', [self.service_name])
|
||||
check_service = self.run_function('service.status', [self.service_name])
|
||||
self.assertFalse(check_service)
|
||||
|
|
|
@ -8,7 +8,8 @@ import os
|
|||
import shutil
|
||||
|
||||
# Import Salt libs
|
||||
import salt.utils
|
||||
import salt.utils.files
|
||||
import salt.utils.path
|
||||
|
||||
# Import Salt Testing libs
|
||||
from tests.support.case import SPMCase, ModuleCase
|
||||
|
@ -29,14 +30,14 @@ class SPMBuildTest(SPMCase, ModuleCase):
|
|||
'''
|
||||
test spm build
|
||||
'''
|
||||
build_spm = self.run_spm('build', self.config, self.formula_dir)
|
||||
self.run_spm('build', self.config, self.formula_dir)
|
||||
spm_file = os.path.join(self.config['spm_build_dir'], 'apache-201506-2.spm')
|
||||
# Make sure .spm file gets created
|
||||
self.assertTrue(os.path.exists(spm_file))
|
||||
# Make sure formula path dir is created
|
||||
self.assertTrue(os.path.isdir(self.config['formula_path']))
|
||||
|
||||
@skipIf(salt.utils.which('fallocate') is None, 'fallocate not installed')
|
||||
@skipIf(salt.utils.path.which('fallocate') is None, 'fallocate not installed')
|
||||
def test_spm_build_big_file(self):
|
||||
'''
|
||||
test spm build with a big file
|
||||
|
@ -47,12 +48,12 @@ class SPMBuildTest(SPMCase, ModuleCase):
|
|||
if space < 2000000:
|
||||
self.skipTest('Not enough space on host to run this test')
|
||||
|
||||
big_file = self.run_function('cmd.run',
|
||||
['fallocate -l 1G {0}'.format(os.path.join(self.formula_sls_dir,
|
||||
'bigfile.txt'))])
|
||||
build_spm = self.run_spm('build', self.config, self.formula_dir)
|
||||
self.run_function('cmd.run',
|
||||
['fallocate -l 1G {0}'.format(os.path.join(self.formula_sls_dir,
|
||||
'bigfile.txt'))])
|
||||
self.run_spm('build', self.config, self.formula_dir)
|
||||
spm_file = os.path.join(self.config['spm_build_dir'], 'apache-201506-2.spm')
|
||||
install = self.run_spm('install', self.config, spm_file)
|
||||
self.run_spm('install', self.config, spm_file)
|
||||
|
||||
get_files = self.run_spm('files', self.config, 'apache')
|
||||
|
||||
|
@ -69,12 +70,12 @@ class SPMBuildTest(SPMCase, ModuleCase):
|
|||
files = ['donotbuild1', 'donotbuild2', 'donotbuild3']
|
||||
|
||||
for git_file in files:
|
||||
with salt.utils.fopen(os.path.join(git_dir, git_file), 'w') as fp:
|
||||
with salt.utils.files.fopen(os.path.join(git_dir, git_file), 'w') as fp:
|
||||
fp.write('Please do not include me in build')
|
||||
|
||||
build_spm = self.run_spm('build', self.config, self.formula_dir)
|
||||
self.run_spm('build', self.config, self.formula_dir)
|
||||
spm_file = os.path.join(self.config['spm_build_dir'], 'apache-201506-2.spm')
|
||||
install = self.run_spm('install', self.config, spm_file)
|
||||
self.run_spm('install', self.config, spm_file)
|
||||
|
||||
get_files = self.run_spm('files', self.config, 'apache')
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue