mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Strip trailing slash in file.directory state
Adding a trailing slash to the directory name (like /etc/chef/) would fail the state if the directory didn't exist and `makedirs` was False. This is because it would use os.path.dirname (which would return /etc/chef) and see that the "parent" directory didn't exist, and fail.
This commit is contained in:
parent
4dac2cf567
commit
2baf78cf8e
@ -1196,6 +1196,10 @@ def directory(name,
|
||||
When 'clean' is set to True, exclude this pattern from removal list
|
||||
and preserve in the destination.
|
||||
'''
|
||||
# Remove trailing slash, if present
|
||||
if name[-1] == '/':
|
||||
name = name[:-1]
|
||||
|
||||
user = _test_owner(kwargs, user=user)
|
||||
|
||||
if 'mode' in kwargs and not dir_mode:
|
||||
|
Loading…
Reference in New Issue
Block a user