Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
3871eebf
Commit
3871eebf
authored
Aug 22, 2014
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8441 from willthames/unarchive_dest_fix
Unarchive should work when parent directory is not writable
parents
1787c293
d9b895b3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
8 deletions
+29
-8
library/files/unarchive
+4
-6
test/integration/roles/test_unarchive/tasks/main.yml
+25
-2
No files found.
library/files/unarchive
View file @
3871eebf
...
...
@@ -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
)
...
...
test/integration/roles/test_unarchive/tasks/main.yml
View file @
3871eebf
...
...
@@ -110,4 +110,28 @@
file
:
path={{output_dir}}/test-unarchive-zip state=absent
-
name
:
remove our test file for the archive
file
:
path={{output_dir}}/foo-unarchive.txt state=absent
\ No newline at end of file
file
:
path={{output_dir}}/foo-unarchive.txt state=absent
-
name
:
check if /tmp/foo-unarchive.text exists
stat
:
path=/tmp/foo-unarchive.txt
ignore_errors
:
True
register
:
unarchive04
-
name
:
fail if the proposed destination file exists for safey
fail
:
msg="/tmp/foo-unarchive.txt already exists, aborting"
when
:
unarchive04.stat.exists
-
name
:
try unarchiving to /tmp
unarchive
:
src={{output_dir}}/test-unarchive.tar.gz dest=/tmp copy=no
register
:
unarchive05
-
name
:
verify that the file was marked as changed
assert
:
that
:
-
"
unarchive05.changed
==
true"
-
name
:
verify that the file was unarchived
file
:
path=/tmp/foo-unarchive.txt state=file
-
name
:
remove our unarchive destination
file
:
path=/tmp/foo-unarchive.txt state=absent
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment