mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Update old utils paths to use new utils paths
This commit is contained in:
parent
68aabff0cf
commit
54341d1a8d
3 changed files with 9 additions and 9 deletions
|
@ -4546,13 +4546,13 @@ def check_perms(name, ret, user, group, mode, attrs=None, follow_symlinks=False)
|
|||
if os.path.islink(name) and not follow_symlinks:
|
||||
pass
|
||||
else:
|
||||
mode = salt.utils.normalize_mode(mode)
|
||||
mode = salt.utils.files.normalize_mode(mode)
|
||||
if mode != perms['lmode']:
|
||||
if __opts__['test'] is True:
|
||||
ret['changes']['mode'] = mode
|
||||
else:
|
||||
set_mode(name, mode)
|
||||
if mode != salt.utils.normalize_mode(get_mode(name)):
|
||||
if mode != salt.utils.files.normalize_mode(get_mode(name)):
|
||||
ret['result'] = False
|
||||
ret['comment'].append(
|
||||
'Failed to change mode to {0}'.format(mode)
|
||||
|
|
|
@ -84,7 +84,7 @@ def _checksum_file_path(path):
|
|||
path.lstrip('/\\'),
|
||||
)
|
||||
elif str(exc).startswith('Cannot mix UNC'):
|
||||
relpath = salt.utils.path_join('unc', path)
|
||||
relpath = salt.utils.path.join('unc', path)
|
||||
else:
|
||||
raise
|
||||
ret = salt.utils.path.join(__opts__['cachedir'], 'archive_hash', relpath)
|
||||
|
|
|
@ -174,7 +174,7 @@ class TestFileState(TestCase, LoaderModuleMockMixin):
|
|||
'file.group_to_gid': mock_empty,
|
||||
'user.info': mock_empty,
|
||||
'user.current': mock_user}):
|
||||
if salt.utils.is_windows():
|
||||
if salt.utils.platform.is_windows():
|
||||
comt = ('User {0} does not exist'.format(user))
|
||||
ret = return_val({'comment': comt, 'name': name})
|
||||
else:
|
||||
|
@ -191,7 +191,7 @@ class TestFileState(TestCase, LoaderModuleMockMixin):
|
|||
'user.current': mock_user}):
|
||||
with patch.dict(filestate.__opts__, {'test': True}):
|
||||
with patch.object(os.path, 'exists', mock_f):
|
||||
if salt.utils.is_windows():
|
||||
if salt.utils.platform.is_windows():
|
||||
comt = ('User {0} does not exist'.format(user))
|
||||
ret = return_val(
|
||||
{
|
||||
|
@ -220,7 +220,7 @@ class TestFileState(TestCase, LoaderModuleMockMixin):
|
|||
with patch.dict(filestate.__opts__, {'test': False}):
|
||||
with patch.object(os.path, 'isdir', mock_f):
|
||||
with patch.object(os.path, 'exists', mock_f):
|
||||
if salt.utils.is_windows():
|
||||
if salt.utils.platform.is_windows():
|
||||
comt = 'User {0} does not exist'.format(user)
|
||||
ret = return_val(
|
||||
{
|
||||
|
@ -250,7 +250,7 @@ class TestFileState(TestCase, LoaderModuleMockMixin):
|
|||
with patch.object(os.path, 'isdir', mock_t):
|
||||
with patch.object(salt.states.file, '_check_symlink_ownership', mock_t):
|
||||
with patch('salt.utils.win_functions.get_sid_from_name', return_value='test-sid'):
|
||||
if salt.utils.is_windows():
|
||||
if salt.utils.platform.is_windows():
|
||||
comt = ('Symlink {0} is present and owned by '
|
||||
'{1}'.format(name, user))
|
||||
else:
|
||||
|
@ -1178,7 +1178,7 @@ class TestFileState(TestCase, LoaderModuleMockMixin):
|
|||
Test to ensure that some text appears at the beginning of a file.
|
||||
'''
|
||||
name = '/etc/motd'
|
||||
if salt.utils.is_windows():
|
||||
if salt.utils.platform.is_windows():
|
||||
name = 'c:\\etc\\motd'
|
||||
source = ['salt://motd/hr-messages.tmpl']
|
||||
sources = ['salt://motd/devops-messages.tmpl']
|
||||
|
@ -1212,7 +1212,7 @@ class TestFileState(TestCase, LoaderModuleMockMixin):
|
|||
comt = ('The following files will be changed:\n/etc:'
|
||||
' directory - new\n')
|
||||
pchanges = {'/etc': {'directory': 'new'}}
|
||||
if salt.utils.is_windows():
|
||||
if salt.utils.platform.is_windows():
|
||||
comt = 'The directory "c:\\etc" will be changed'
|
||||
pchanges = {'c:\\etc': {'directory': 'new'}}
|
||||
ret.update({'comment': comt, 'name': name, 'pchanges': pchanges})
|
||||
|
|
Loading…
Add table
Reference in a new issue