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
f8396622
Commit
f8396622
authored
Jul 03, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3418 from stoned/filter-bool
Add Jinja2 filter |bool : return boolean interpretation of the value
parents
2f4c930d
0b3483cf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
lib/ansible/runner/filter_plugins/core.py
+15
-0
No files found.
lib/ansible/runner/filter_plugins/core.py
View file @
f8396622
...
...
@@ -19,6 +19,7 @@ import base64
import
json
import
os.path
import
yaml
import
types
from
ansible
import
errors
def
to_nice_yaml
(
*
a
,
**
kw
):
...
...
@@ -49,6 +50,17 @@ def mandatory(a):
raise
errors
.
AnsibleError
(
'Mandatory variable not defined.'
)
return
a
def
bool
(
a
):
''' return a bool for the arg '''
if
a
is
None
or
type
(
a
)
==
bool
:
return
a
if
type
(
a
)
in
types
.
StringTypes
:
a
=
a
.
lower
()
if
a
in
[
'yes'
,
'on'
,
'1'
,
'true'
,
1
]:
return
True
else
:
return
False
class
FilterModule
(
object
):
''' Ansible core jinja2 filters '''
...
...
@@ -78,5 +90,8 @@ class FilterModule(object):
# variable existence
'mandatory'
:
mandatory
,
# value as boolean
'bool'
:
bool
,
}
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