Expands path on file operations
Path might have to be expanded on some operations. It seems that path containing '~' are not. Using os.path.expanduser in appropriate places solves the problem, but this might be required in many other places.
This commit is contained in:
parent
d34e320e12
commit
0037a19389
1 changed files with 3 additions and 0 deletions
|
@ -262,6 +262,7 @@ class AnsibleModule(object):
|
|||
return context
|
||||
|
||||
def user_and_group(self, filename):
|
||||
filename = os.path.expanduser(filename)
|
||||
st = os.stat(filename)
|
||||
uid = st.st_uid
|
||||
gid = st.st_gid
|
||||
|
@ -338,6 +339,8 @@ class AnsibleModule(object):
|
|||
return changed
|
||||
|
||||
def set_mode_if_different(self, path, mode, changed):
|
||||
path = os.path.expanduser(path)
|
||||
|
||||
if mode is None:
|
||||
return changed
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue