mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Merge pull request #49172 from Ch3LL/bp-49118
[2018.3.3] cherry pick #49118
This commit is contained in:
commit
b3a247bfbb
@ -4079,8 +4079,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)
|
||||
|
@ -2429,7 +2429,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:
|
||||
|
@ -861,14 +861,10 @@ class FileTest(ModuleCase, SaltReturnAssertsMixin):
|
||||
self.assertFalse(os.path.exists(straydir))
|
||||
self.assertTrue(os.path.isdir(name))
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), 'Skip on windows')
|
||||
@with_tempdir()
|
||||
def test_directory_clean_exclude(self, base_dir):
|
||||
'''
|
||||
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(base_dir, 'directory_clean_dir')
|
||||
if not os.path.isdir(name):
|
||||
@ -904,10 +900,14 @@ class FileTest(ModuleCase, SaltReturnAssertsMixin):
|
||||
self.assertFalse(os.path.exists(strayfile2))
|
||||
self.assertTrue(os.path.exists(keepfile))
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), 'Skip on windows')
|
||||
@with_tempdir()
|
||||
def test_test_directory_clean_exclude(self, base_dir):
|
||||
'''
|
||||
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(base_dir, 'directory_clean_dir')
|
||||
os.mkdir(name)
|
||||
|
Loading…
Reference in New Issue
Block a user