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
cb5f630f
Commit
cb5f630f
authored
Jun 22, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't post_validate vars and vars_files on Play objects
Fixes #11343
parent
ff251a0d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
6 deletions
+22
-6
lib/ansible/playbook/base.py
+8
-6
lib/ansible/playbook/play.py
+14
-0
No files found.
lib/ansible/playbook/base.py
View file @
cb5f630f
...
...
@@ -254,15 +254,17 @@ class Base:
raise
AnsibleParserError
(
"the field '
%
s' is required but was not set"
%
name
)
try
:
# if the attribute contains a variable, template it now
value
=
templar
.
template
(
getattr
(
self
,
name
))
# run the post-validator if present
# Run the post-validator if present. These methods are responsible for
# using the given templar to template the values, if required.
method
=
getattr
(
self
,
'_post_validate_
%
s'
%
name
,
None
)
if
method
:
value
=
method
(
attribute
,
value
,
all_vars
,
templar
.
_fail_on_undefined_errors
)
value
=
method
(
attribute
,
getattr
(
self
,
name
),
templar
)
else
:
# otherwise, just make sure the attribute is of the type it should be
# if the attribute contains a variable, template it now
value
=
templar
.
template
(
getattr
(
self
,
name
))
# and make sure the attribute is of the type it should be
if
value
is
not
None
:
if
attribute
.
isa
==
'string'
:
value
=
unicode
(
value
)
elif
attribute
.
isa
==
'int'
:
...
...
lib/ansible/playbook/play.py
View file @
cb5f630f
...
...
@@ -187,6 +187,20 @@ class Play(Base, Taggable, Become):
roles
.
append
(
Role
.
load
(
ri
))
return
roles
def
_post_validate_vars
(
self
,
attr
,
value
,
templar
):
'''
Override post validation of vars on the play, as we don't want to
template these too early.
'''
return
value
def
_post_validate_vars_files
(
self
,
attr
,
value
,
templar
):
'''
Override post validation of vars_files on the play, as we don't want to
template these too early.
'''
return
value
# FIXME: post_validation needs to ensure that become/su/sudo have only 1 set
def
_compile_roles
(
self
):
...
...
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