Merge pull request #1830 from willthames/fix_tilde_path_in_file
Fix behaviour when file handles a path with tildepull/4420/head
commit
3f4847a3ab
|
@ -254,7 +254,10 @@ class AnsibleModule(object):
|
||||||
return context
|
return context
|
||||||
try:
|
try:
|
||||||
ret = selinux.lgetfilecon(path)
|
ret = selinux.lgetfilecon(path)
|
||||||
except:
|
except OSError, e:
|
||||||
|
if e.errno == errno.ENOENT:
|
||||||
|
self.fail_json(path=path, msg='path %s does not exist' % path)
|
||||||
|
else:
|
||||||
self.fail_json(path=path, msg='failed to retrieve selinux context')
|
self.fail_json(path=path, msg='failed to retrieve selinux context')
|
||||||
if ret[0] == -1:
|
if ret[0] == -1:
|
||||||
return context
|
return context
|
||||||
|
|
|
@ -139,7 +139,7 @@ def main():
|
||||||
|
|
||||||
params = module.params
|
params = module.params
|
||||||
state = params['state']
|
state = params['state']
|
||||||
path = os.path.expanduser(params['path'])
|
params['path'] = path = os.path.expanduser(params['path'])
|
||||||
|
|
||||||
# source is both the source of a symlink or an informational passing of the src for a template module
|
# source is both the source of a symlink or an informational passing of the src for a template module
|
||||||
# or copy module, even if this module never uses it, it is needed to key off some things
|
# or copy module, even if this module never uses it, it is needed to key off some things
|
||||||
|
|
Loading…
Reference in New Issue