Change salt.utils.files.is_text_files calls to use __utils__

This commit is contained in:
rallytime 2017-09-01 15:19:05 -04:00
parent e1621f7b2e
commit eea53a1244
2 changed files with 11 additions and 11 deletions

View File

@ -126,8 +126,8 @@ def _binary_replace(old, new):
This function should only be run AFTER it has been determined that the
files differ.
'''
old_isbin = not salt.utils.files.is_text_file(old)
new_isbin = not salt.utils.files.is_text_file(new)
old_isbin = not __utils__['files.is_text_file'](old)
new_isbin = not __utils__['files.is_text_file'](new)
if any((old_isbin, new_isbin)):
if all((old_isbin, new_isbin)):
return u'Replace binary file'
@ -1436,7 +1436,7 @@ def comment_line(path,
raise SaltInvocationError('File not found: {0}'.format(path))
# Make sure it is a text file
if not salt.utils.files.is_text_file(path):
if not __utils__['files.is_text_file'](path):
raise SaltInvocationError(
'Cannot perform string replacements on a binary file: {0}'.format(path))
@ -2180,7 +2180,7 @@ def replace(path,
else:
raise SaltInvocationError('File not found: {0}'.format(path))
if not salt.utils.files.is_text_file(path):
if not __utils__['files.is_text_file'](path):
raise SaltInvocationError(
'Cannot perform string replacements on a binary file: {0}'
.format(path)
@ -2497,7 +2497,7 @@ def blockreplace(path,
'Only one of append and prepend_if_not_found is permitted'
)
if not salt.utils.files.is_text_file(path):
if not __utils__['files.is_text_file'](path):
raise SaltInvocationError(
'Cannot perform string replacements on a binary file: {0}'
.format(path)

View File

@ -4366,7 +4366,7 @@ def comment(name, regex, char='#', backup='.bak'):
ret['result'] = __salt__['file.search'](name, unanchor_regex, multiline=True)
if slines != nlines:
if not salt.utils.files.is_text_file(name):
if not __utils__['files.is_text_file'](name):
ret['changes']['diff'] = 'Replace binary file'
else:
# Changes happened, add them
@ -4478,7 +4478,7 @@ def uncomment(name, regex, char='#', backup='.bak'):
)
if slines != nlines:
if not salt.utils.files.is_text_file(name):
if not __utils__['files.is_text_file'](name):
ret['changes']['diff'] = 'Replace binary file'
else:
# Changes happened, add them
@ -4721,7 +4721,7 @@ def append(name,
nlines = list(slines)
nlines.extend(append_lines)
if slines != nlines:
if not salt.utils.files.is_text_file(name):
if not __utils__['files.is_text_file'](name):
ret['changes']['diff'] = 'Replace binary file'
else:
# Changes happened, add them
@ -4746,7 +4746,7 @@ def append(name,
nlines = nlines.splitlines()
if slines != nlines:
if not salt.utils.files.is_text_file(name):
if not __utils__['files.is_text_file'](name):
ret['changes']['diff'] = 'Replace binary file'
else:
# Changes happened, add them
@ -4914,7 +4914,7 @@ def prepend(name,
if __opts__['test']:
nlines = test_lines + slines
if slines != nlines:
if not salt.utils.files.is_text_file(name):
if not __utils__['files.is_text_file'](name):
ret['changes']['diff'] = 'Replace binary file'
else:
# Changes happened, add them
@ -4957,7 +4957,7 @@ def prepend(name,
nlines = nlines.splitlines(True)
if slines != nlines:
if not salt.utils.files.is_text_file(name):
if not __utils__['files.is_text_file'](name):
ret['changes']['diff'] = 'Replace binary file'
else:
# Changes happened, add them