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
598b9c6b
Commit
598b9c6b
authored
Feb 12, 2014
by
Richard C Isaacson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup per notes.
Some small changes to per notes from @mpdehann.
parent
cb7c2b75
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
22 deletions
+34
-22
lib/ansible/runner/action_plugins/unarchive.py
+1
-1
library/files/unarchive
+6
-6
test/TestPlayBook.py
+3
-3
test/playbook-unarchive.yml
+24
-12
No files found.
lib/ansible/runner/action_plugins/unarchive.py
View file @
598b9c6b
...
...
@@ -63,7 +63,7 @@ class ActionModule(object):
remote_md5
=
self
.
runner
.
_remote_md5
(
conn
,
tmp
,
dest
)
if
remote_md5
!=
'3'
:
result
=
dict
(
failed
=
True
,
msg
=
"dest must be an existing dir"
,
rc
=
remote_md5
)
result
=
dict
(
failed
=
True
,
msg
=
"dest must be an existing dir"
)
return
ReturnData
(
conn
=
conn
,
result
=
result
)
if
copy
:
...
...
library/files/unarchive
View file @
598b9c6b
...
...
@@ -69,7 +69,7 @@ import os
# class to handle .zip files
class
_zipf
ile
(
object
):
class
ZipF
ile
(
object
):
def
__init__
(
self
,
src
,
dest
,
module
):
self
.
src
=
src
...
...
@@ -93,7 +93,7 @@ class _zipfile(object):
# class to handle gzipped tar files
class
_tgzf
ile
(
object
):
class
TgzF
ile
(
object
):
def
__init__
(
self
,
src
,
dest
,
module
):
self
.
src
=
src
...
...
@@ -124,7 +124,7 @@ class _tgzfile(object):
# class to handle tar files that aren't compressed
class
_tarfile
(
_tgzf
ile
):
class
TarFile
(
TgzF
ile
):
def
__init__
(
self
,
src
,
dest
,
module
):
self
.
src
=
src
self
.
dest
=
dest
...
...
@@ -133,7 +133,7 @@ class _tarfile(_tgzfile):
# class to handle bzip2 compressed tar files
class
_tarbzip
(
_tgzf
ile
):
class
TarBzip
(
TgzF
ile
):
def
__init__
(
self
,
src
,
dest
,
module
):
self
.
src
=
src
self
.
dest
=
dest
...
...
@@ -142,7 +142,7 @@ class _tarbzip(_tgzfile):
# class to handle xz compressed tar files
class
_tarxz
(
_tgzf
ile
):
class
TarXz
(
TgzF
ile
):
def
__init__
(
self
,
src
,
dest
,
module
):
self
.
src
=
src
self
.
dest
=
dest
...
...
@@ -152,7 +152,7 @@ class _tarxz(_tgzfile):
# try handlers in order and return the one that works or bail if none work
def
pick_handler
(
src
,
dest
,
module
):
handlers
=
[
_tgzfile
,
_zipfile
,
_tarfile
,
_tarbzip
,
_tarx
z
]
handlers
=
[
TgzFile
,
ZipFile
,
TarFile
,
TarBzip
,
TarX
z
]
for
handler
in
handlers
:
obj
=
handler
(
src
,
dest
,
module
)
if
obj
.
can_handle_archive
():
...
...
test/TestPlayBook.py
View file @
598b9c6b
...
...
@@ -416,10 +416,10 @@ class TestPlaybook(unittest.TestCase):
expected
=
{
"localhost"
:
{
"changed"
:
41
,
"changed"
:
29
,
"failures"
:
0
,
"ok"
:
45
,
"skipped"
:
0
,
"ok"
:
33
,
"skipped"
:
12
,
"unreachable"
:
0
}
}
...
...
test/playbook-unarchive.yml
View file @
598b9c6b
...
...
@@ -14,10 +14,12 @@
-
unarchive
:
src={{filesdir}}/test.tar dest={{testdir}}
register
:
res
-
command
:
test -f {{testdir}}/foo
-
command
:
test "{{res.changed}}" = "True"
-
fail
:
msg="Resource was expected to be changed."
when
:
not res|changed
-
unarchive
:
src={{filesdir}}/test.tar dest={{testdir}}
register
:
res
-
command
:
test "{{res.changed}}" = "False"
-
fail
:
msg="Resource was not expected to be changed."
when
:
res|changed
-
name
:
"
Simple
tar.gz
unarchive."
command
:
rm -rf {{testdir}}
...
...
@@ -25,10 +27,12 @@
-
unarchive
:
src={{filesdir}}/test.tar.gz dest={{testdir}}
register
:
res
-
command
:
test -f {{testdir}}/foo
-
command
:
test "{{res.changed}}" = "True"
-
fail
:
msg="Resource was expected to be changed."
when
:
not res|changed
-
unarchive
:
src={{filesdir}}/test.tar.gz dest={{testdir}}
register
:
res
-
command
:
test "{{res.changed}}" = "False"
-
fail
:
msg="Resource was not expected to be changed."
when
:
res|changed
-
name
:
"
Simple
zip
unarchive."
command
:
rm -rf {{testdir}}
...
...
@@ -36,10 +40,12 @@
-
unarchive
:
src={{filesdir}}/test.zip dest={{testdir}}
register
:
res
-
command
:
test -f {{testdir}}/foo
-
command
:
test "{{res.changed}}" = "True"
-
fail
:
msg="Resource was expected to be changed."
when
:
not res|changed
-
unarchive
:
src={{filesdir}}/test.zip dest={{testdir}}
register
:
res
-
command
:
test "{{res.changed}}" = "True"
-
fail
:
msg="Resource was expected to be changed."
when
:
not res|changed
-
name
:
"
Unarchive
a
local
tar
file."
command
:
rm -rf {{testdir}}
...
...
@@ -48,10 +54,12 @@
-
unarchive
:
src={{testdir}}/test.tar dest={{testdir}}
register
:
res
-
command
:
test -f {{testdir}}/foo
-
command
:
test "{{res.changed}}" = "True"
-
fail
:
msg="Resource was expected to be changed."
when
:
not res|changed
-
unarchive
:
src={{testdir}}/test.tar dest={{testdir}}
register
:
res
-
command
:
test "{{res.changed}}" = "False"
-
fail
:
msg="Resource was not expected to be changed."
when
:
res|changed
-
name
:
"
Unarchive
a
local
tar.gz
file."
command
:
rm -rf {{testdir}}
...
...
@@ -60,10 +68,12 @@
-
unarchive
:
src={{testdir}}/test.tar.gz dest={{testdir}}
register
:
res
-
command
:
test -f {{testdir}}/foo
-
command
:
test "{{res.changed}}" = "True"
-
fail
:
msg="Resource was expected to be changed."
when
:
not res|changed
-
unarchive
:
src={{testdir}}/test.tar.gz dest={{testdir}}
register
:
res
-
command
:
test "{{res.changed}}" = "False"
-
fail
:
msg="Resource was not expected to be changed."
when
:
res|changed
-
name
:
"
Unarchive
a
local
zip
file."
command
:
rm -rf {{testdir}}
...
...
@@ -72,7 +82,9 @@
-
unarchive
:
src={{testdir}}/test.zip dest={{testdir}}
register
:
res
-
command
:
test -f {{testdir}}/foo
-
command
:
test "{{res.changed}}" = "True"
-
fail
:
msg="Resource was expected to be changed."
when
:
not res|changed
-
unarchive
:
src={{testdir}}/test.zip dest={{testdir}}
register
:
res
-
command
:
test "{{res.changed}}" = "True"
-
fail
:
msg="Resource was expected to be changed."
when
:
not res|changed
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