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
e5d45311
Commit
e5d45311
authored
Oct 10, 2013
by
Serge van Ginderachter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement a |changed filter plugin
parent
16947041
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
lib/ansible/runner/filter_plugins/core.py
+13
-0
No files found.
lib/ansible/runner/filter_plugins/core.py
View file @
e5d45311
...
@@ -34,6 +34,7 @@ def to_nice_json(*a, **kw):
...
@@ -34,6 +34,7 @@ def to_nice_json(*a, **kw):
return
json
.
dumps
(
*
a
,
indent
=
4
,
sort_keys
=
True
,
**
kw
)
return
json
.
dumps
(
*
a
,
indent
=
4
,
sort_keys
=
True
,
**
kw
)
def
failed
(
*
a
,
**
kw
):
def
failed
(
*
a
,
**
kw
):
''' Test if task result yields failed '''
item
=
a
[
0
]
item
=
a
[
0
]
if
type
(
item
)
!=
dict
:
if
type
(
item
)
!=
dict
:
raise
errors
.
AnsibleFilterError
(
"|failed expects a dictionary"
)
raise
errors
.
AnsibleFilterError
(
"|failed expects a dictionary"
)
...
@@ -45,9 +46,18 @@ def failed(*a, **kw):
...
@@ -45,9 +46,18 @@ def failed(*a, **kw):
return
False
return
False
def
success
(
*
a
,
**
kw
):
def
success
(
*
a
,
**
kw
):
''' Test if task result yields success '''
return
not
failed
(
*
a
,
**
kw
)
return
not
failed
(
*
a
,
**
kw
)
def
changed
(
*
a
,
**
kw
):
''' Test if task result yields changed '''
item
=
a
[
0
]
if
type
(
item
)
!=
dict
:
raise
errors
.
AnsibleFilterError
(
"|changed expects a dictionary"
)
return
item
.
get
(
'changed'
,
False
)
def
skipped
(
*
a
,
**
kw
):
def
skipped
(
*
a
,
**
kw
):
''' Test if task result yields skipped '''
item
=
a
[
0
]
item
=
a
[
0
]
if
type
(
item
)
!=
dict
:
if
type
(
item
)
!=
dict
:
raise
errors
.
AnsibleFilterError
(
"|skipped expects a dictionary"
)
raise
errors
.
AnsibleFilterError
(
"|skipped expects a dictionary"
)
...
@@ -106,6 +116,9 @@ class FilterModule(object):
...
@@ -106,6 +116,9 @@ class FilterModule(object):
'failed'
:
failed
,
'failed'
:
failed
,
'success'
:
success
,
'success'
:
success
,
# changed testing
'changed'
:
changed
,
# skip testing
# skip testing
'skipped'
:
skipped
,
'skipped'
:
skipped
,
...
...
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