Multiple fixes for integration.states.test_file

- Fix wart in PR #49087 file://c:\foo\bar vs c:\foo\bar local paths
- Finalize fix for test_issue_8343_accumulated_require_in
- Fix wart in PR #49088 Ignore proper directory test
This commit is contained in:
Daniel A. Wozniak 2018-08-14 18:37:53 +00:00
parent 8954dd269f
commit c6b781eea5
No known key found for this signature in database
GPG Key ID: 166B9D2C06C82D61
3 changed files with 13 additions and 7 deletions

View File

@ -3893,8 +3893,12 @@ def get_managed(
parsed_path = os.path.join(
urlparsed_source.netloc, urlparsed_source.path).rstrip(os.sep)
unix_local_source = parsed_scheme in ('file', '')
if unix_local_source:
if parsed_scheme == '':
parsed_path = sfn = source
if not os.path.exists(sfn):
msg = 'Local file source {0} does not exist'.format(sfn)
return '', {}, msg
elif parsed_scheme == 'file':
sfn = parsed_path
if not os.path.exists(sfn):
msg = 'Local file source {0} does not exist'.format(sfn)

View File

@ -2377,7 +2377,9 @@ def managed(name,
'contents_grains is not a string or list of strings, and '
'is not binary data. SLS is likely malformed.'
)
contents = os.linesep.join(validated_contents)
contents = os.linesep.join(
[line.rstrip('\n').rstrip('\r') for line in validated_contents]
)
if contents_newline and not contents.endswith(os.linesep):
contents += os.linesep
if template:

View File

@ -844,13 +844,9 @@ class FileTest(ModuleCase, SaltReturnAssertsMixin):
finally:
shutil.rmtree(name, ignore_errors=True)
@skipIf(salt.utils.is_windows(), 'Skip on windows')
def test_directory_clean_exclude(self):
'''
file.directory with clean=True and exclude_pat set
Skipped on windows because clean and exclude_pat not supported by
salt.sates.file._check_directory_win
'''
name = os.path.join(TMP, 'directory_clean_dir')
if not os.path.isdir(name):
@ -889,9 +885,13 @@ class FileTest(ModuleCase, SaltReturnAssertsMixin):
finally:
shutil.rmtree(name, ignore_errors=True)
@skipIf(salt.utils.is_windows(), 'Skip on windows')
def test_test_directory_clean_exclude(self):
'''
file.directory with test=True, clean=True and exclude_pat set
Skipped on windows because clean and exclude_pat not supported by
salt.sates.file._check_directory_win
'''
name = os.path.join(TMP, 'directory_clean_dir')
if not os.path.isdir(name):