Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Back-port PR #52212 to 2018.3 #52215

Merged
merged 2 commits into from Mar 21, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 15 additions & 11 deletions salt/states/file.py
Expand Up @@ -5044,19 +5044,23 @@ def append(name,

if makedirs is True:
dirname = os.path.dirname(name)
if not __salt__['file.directory_exists'](dirname):
try:
_makedirs(name=name)
except CommandExecutionError as exc:
return _error(ret, 'Drive {0} is not mapped'.format(exc.message))
if __opts__['test']:
ret['comment'] = 'Directory {0} is set to be updated'.format(dirname)
ret['result'] = None
else:
if not __salt__['file.directory_exists'](dirname):
try:
_makedirs(name=name)
except CommandExecutionError as exc:
return _error(ret, 'Drive {0} is not mapped'.format(exc.message))

if salt.utils.platform.is_windows():
check_res, check_msg, ret['pchanges'] = _check_directory_win(dirname)
else:
check_res, check_msg, ret['pchanges'] = _check_directory(dirname)
if salt.utils.platform.is_windows():
check_res, check_msg, ret['pchanges'] = _check_directory_win(dirname)
else:
check_res, check_msg, ret['pchanges'] = _check_directory(dirname)

if not check_res:
return _error(ret, check_msg)
if not check_res:
return _error(ret, check_msg)

check_res, check_msg = _check_file(name)
if not check_res:
Expand Down