mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
return friendlier error when failing to make dirs
This commit is contained in:
parent
5bb4ee0c1e
commit
38cca53669
1 changed files with 3 additions and 2 deletions
|
@ -19,7 +19,8 @@ __metaclass__ = type
|
|||
|
||||
import os
|
||||
from errno import EEXIST
|
||||
from ansible.utils.unicode import to_bytes
|
||||
from ansible.errors import AnsibleError
|
||||
from ansible.utils.unicode import to_bytes, to_str
|
||||
|
||||
__all__ = ['unfrackpath']
|
||||
|
||||
|
@ -42,4 +43,4 @@ def makedirs_safe(path, mode=None):
|
|||
os.makedirs(path)
|
||||
except OSError as e:
|
||||
if e.errno != EEXIST:
|
||||
raise
|
||||
raise AnsibleError("Unable to create local directories(%s): %s" % (path, to_str(e)))
|
||||
|
|
Loading…
Reference in a new issue