mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
More optimization.
This commit is contained in:
parent
5a08266814
commit
cf1857904b
1 changed files with 2 additions and 7 deletions
|
@ -2060,14 +2060,9 @@ def directory(name,
|
|||
return _error(
|
||||
ret, 'Specified file {0} is not an absolute path'.format(name))
|
||||
|
||||
# checkng if bad symlink and force is applied
|
||||
bad_link = False
|
||||
if os.path.islink(name) and force:
|
||||
if not os.path.exists(os.readlink(name)):
|
||||
bad_link = True
|
||||
|
||||
# Check for existing file or symlink
|
||||
if os.path.isfile(name) or (not allow_symlink and os.path.islink(name)) or bad_link:
|
||||
if os.path.isfile(name) or (not allow_symlink and os.path.islink(name)) \
|
||||
or (force and os.path.islink(name)):
|
||||
# Was a backupname specified
|
||||
if backupname is not None:
|
||||
# Make a backup first
|
||||
|
|
Loading…
Add table
Reference in a new issue