summaryrefslogtreecommitdiff
path: root/files
diff options
context:
space:
mode:
authorMichael DeHaan <michael.dehaan@gmail.com>2014-08-22 15:05:42 -0400
committerMichael DeHaan <michael.dehaan@gmail.com>2014-08-22 15:05:42 -0400
commitef10c2dd9b6865e585038c4bcbcf0874f056d1ac (patch)
tree9230828dee2c310d44460dc8dfbf5f602403cef1 /files
parent0278b40f5f26db4b3320f6cced989de7fe71d346 (diff)
parentde16785b8ce961c5eb152854032c8a9306131e87 (diff)
downloadansible-modules-extras-ef10c2dd9b6865e585038c4bcbcf0874f056d1ac.tar.gz
Merge pull request #8441 from willthames/unarchive_dest_fix
Unarchive should work when parent directory is not writable
Diffstat (limited to 'files')
-rw-r--r--files/unarchive10
1 files changed, 4 insertions, 6 deletions
diff --git a/files/unarchive b/files/unarchive
index 52f53324..657e4649 100644
--- a/files/unarchive
+++ b/files/unarchive
@@ -115,8 +115,6 @@ class TgzFile(object):
self.zipflag = 'z'
def is_unarchived(self):
- dirof = os.path.dirname(self.dest)
- destbase = os.path.basename(self.dest)
cmd = '%s -v -C "%s" --diff -%sf "%s"' % (self.cmd_path, self.dest, self.zipflag, self.src)
rc, out, err = self.module.run_command(cmd)
unarchived = (rc == 0)
@@ -220,10 +218,10 @@ def main():
)
# is dest OK to receive tar file?
- if not os.path.exists(os.path.dirname(dest)):
- module.fail_json(msg="Destination directory '%s' does not exist" % (os.path.dirname(dest)))
- if not os.access(os.path.dirname(dest), os.W_OK):
- module.fail_json(msg="Destination '%s' not writable" % (os.path.dirname(dest)))
+ if not os.path.isdir(dest):
+ module.fail_json(msg="Destination '%s' is not a directory" % dest)
+ if not os.access(dest, os.W_OK):
+ module.fail_json(msg="Destination '%s' not writable" % dest)
handler = pick_handler(src, dest, module)