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
54117ab2
Commit
54117ab2
authored
Feb 19, 2014
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modified assert module to take tests as an array
parent
bee089d5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
16 deletions
+20
-16
lib/ansible/runner/action_plugins/assert.py
+7
-6
tests_new/integration/roles/test_copy/tasks/main.yml
+13
-10
No files found.
lib/ansible/runner/action_plugins/assert.py
View file @
54117ab2
...
...
@@ -46,11 +46,12 @@ class ActionModule(object):
if
not
'that'
in
args
:
raise
errors
.
AnsibleError
(
'conditional required in "that" string'
)
result
=
utils
.
check_conditional
(
args
[
'that'
],
self
.
runner
.
basedir
,
inject
,
fail_on_undefined
=
True
)
if
not
isinstance
(
args
[
'that'
],
list
):
args
[
'that'
]
=
[
args
[
'that'
]
]
if
not
result
:
result
=
dict
(
failed
=
True
,
assertion
=
args
[
'that'
],
evaluated_to
=
result
)
else
:
result
=
dict
(
msg
=
'ok'
,
assertion
=
args
[
'that'
],
evaluated_to
=
result
)
for
that
in
args
[
'that'
]
:
result
=
utils
.
check_conditional
(
args
[
'that'
],
self
.
runner
.
basedir
,
inject
,
fail_on_undefined
=
True
)
if
not
result
:
return
ReturnData
(
conn
=
conn
,
result
=
dict
(
failed
=
True
,
assertion
=
that
,
evaluated_to
=
result
)
)
return
ReturnData
(
conn
=
conn
,
result
=
result
)
return
ReturnData
(
conn
=
conn
,
result
=
dict
(
msg
=
'all assertions passed'
)
)
tests_new/integration/roles/test_copy/tasks/main.yml
View file @
54117ab2
...
...
@@ -22,16 +22,19 @@
copy
:
src=foo.txt dest={{output_file}}
register
:
copy_result
-
assert
:
{
that
:
"
'changed'
in
copy_result"
}
-
assert
:
{
that
:
"
'dest'
in
copy_result"
}
-
assert
:
{
that
:
"
'group'
in
copy_result"
}
-
assert
:
{
that
:
"
'gid'
in
copy_result"
}
-
assert
:
{
that
:
"
'md5sum'
in
copy_result"
}
-
assert
:
{
that
:
"
'owner'
in
copy_result"
}
-
assert
:
{
that
:
"
'size'
in
copy_result"
}
-
assert
:
{
that
:
"
'src'
in
copy_result"
}
-
assert
:
{
that
:
"
'state'
in
copy_result"
}
-
assert
:
{
that
:
"
'uid'
in
copy_result"
}
-
name
:
assert basic copy worked
assert
:
that
:
-
"
'changed'
in
copy_result"
-
"
'dest'
in
copy_result"
-
"
'group'
in
copy_result"
-
"
'gid'
in
copy_result"
-
"
'md5sum'
in
copy_result"
-
"
'owner'
in
copy_result"
-
"
'size'
in
copy_result"
-
"
'src'
in
copy_result"
-
"
'state'
in
copy_result"
-
"
'uid'
in
copy_result"
-
name
:
verify that the file was marked as 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