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
ed05db52
Commit
ed05db52
authored
Jan 28, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing playbook includes in v2 where included paths are relative
parent
b07ab419
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
+12
-5
v2/ansible/playbook/__init__.py
+1
-1
v2/ansible/playbook/playbook_include.py
+11
-4
No files found.
v2/ansible/playbook/__init__.py
View file @
ed05db52
...
...
@@ -72,7 +72,7 @@ class Playbook:
raise
AnsibleParserError
(
"playbook entries must be either a valid play or an include statement"
,
obj
=
entry
)
if
'include'
in
entry
:
pb
=
PlaybookInclude
.
load
(
entry
,
variable_manager
=
variable_manager
,
loader
=
self
.
_loader
)
pb
=
PlaybookInclude
.
load
(
entry
,
basedir
=
self
.
_basedir
,
variable_manager
=
variable_manager
,
loader
=
self
.
_loader
)
self
.
_entries
.
extend
(
pb
.
_entries
)
else
:
entry_obj
=
Play
.
load
(
entry
,
variable_manager
=
variable_manager
,
loader
=
self
.
_loader
)
...
...
v2/ansible/playbook/playbook_include.py
View file @
ed05db52
...
...
@@ -19,6 +19,8 @@
from
__future__
import
(
absolute_import
,
division
,
print_function
)
__metaclass__
=
type
import
os
from
ansible.parsing.splitter
import
split_args
,
parse_kv
from
ansible.parsing.yaml.objects
import
AnsibleBaseYAMLObject
,
AnsibleMapping
from
ansible.playbook.attribute
import
FieldAttribute
...
...
@@ -33,10 +35,10 @@ class PlaybookInclude(Base):
_vars
=
FieldAttribute
(
isa
=
'dict'
,
default
=
dict
())
@staticmethod
def
load
(
data
,
variable_manager
=
None
,
loader
=
None
):
return
PlaybookInclude
()
.
load_data
(
ds
=
data
,
variable_manager
=
variable_manager
,
loader
=
loader
)
def
load
(
data
,
basedir
,
variable_manager
=
None
,
loader
=
None
):
return
PlaybookInclude
()
.
load_data
(
ds
=
data
,
basedir
=
basedir
,
variable_manager
=
variable_manager
,
loader
=
loader
)
def
load_data
(
self
,
ds
,
variable_manager
=
None
,
loader
=
None
):
def
load_data
(
self
,
ds
,
basedir
,
variable_manager
=
None
,
loader
=
None
):
'''
Overrides the base load_data(), as we're actually going to return a new
Playbook() object rather than a PlaybookInclude object
...
...
@@ -51,7 +53,12 @@ class PlaybookInclude(Base):
# then we use the object to load a Playbook
pb
=
Playbook
(
loader
=
loader
)
pb
.
_load_playbook_data
(
file_name
=
new_obj
.
include
,
variable_manager
=
variable_manager
)
file_name
=
new_obj
.
include
if
not
os
.
path
.
isabs
(
file_name
):
file_name
=
os
.
path
.
join
(
basedir
,
file_name
)
pb
.
_load_playbook_data
(
file_name
=
file_name
,
variable_manager
=
variable_manager
)
# finally, playbook includes can specify a list of variables, which are simply
# used to update the vars of each play in the playbook
...
...
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