Skip to content

Commit

Permalink
Move try except block
Browse files Browse the repository at this point in the history
  • Loading branch information
twangboy committed Jan 9, 2018
1 parent db52f08 commit 0be187c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions salt/states/file.py
Expand Up @@ -2390,8 +2390,8 @@ def managed(name,
**kwargs
)

try:
if salt.utils.platform.is_windows():
if salt.utils.platform.is_windows():
try:
ret = __salt__['file.check_perms'](
path=name,
ret=ret,
Expand All @@ -2400,9 +2400,9 @@ def managed(name,
deny_perms=win_deny_perms,
inheritance=win_inheritance,
reset=win_perms_reset)
except CommandExecutionError as exc:
if exc.strerror.startswith('Path not found'):
ret['pchanges'] = '{0} will be created'.format(name)
except CommandExecutionError as exc:
if exc.strerror.startswith('Path not found'):
ret['pchanges'] = '{0} will be created'.format(name)

if isinstance(ret['pchanges'], tuple):
ret['result'], ret['comment'] = ret['pchanges']
Expand Down

0 comments on commit 0be187c

Please sign in to comment.