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
f1b8323b
Commit
f1b8323b
authored
Aug 23, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed host/group var loading when inventory is a directory
parent
af06a97f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
lib/ansible/inventory/__init__.py
+11
-6
No files found.
lib/ansible/inventory/__init__.py
View file @
f1b8323b
...
@@ -557,7 +557,7 @@ class Inventory(object):
...
@@ -557,7 +557,7 @@ class Inventory(object):
def
remove_restriction
(
self
):
def
remove_restriction
(
self
):
""" Do not restrict list operations """
""" Do not restrict list operations """
self
.
_restriction
=
None
self
.
_restriction
=
None
def
is_file
(
self
):
def
is_file
(
self
):
""" did inventory come from a file? """
""" did inventory come from a file? """
if
not
isinstance
(
self
.
host_list
,
basestring
):
if
not
isinstance
(
self
.
host_list
,
basestring
):
...
@@ -566,12 +566,16 @@ class Inventory(object):
...
@@ -566,12 +566,16 @@ class Inventory(object):
def
basedir
(
self
):
def
basedir
(
self
):
""" if inventory came from a file, what's the directory? """
""" if inventory came from a file, what's the directory? """
dname
=
self
.
host_list
if
not
self
.
is_file
():
if
not
self
.
is_file
():
return
None
dname
=
None
dname
=
os
.
path
.
dirname
(
self
.
host_list
)
elif
os
.
path
.
isdir
(
self
.
host_list
):
if
dname
is
None
or
dname
==
''
or
dname
==
'.'
:
dname
=
self
.
host_list
cwd
=
os
.
getcwd
()
else
:
return
os
.
path
.
abspath
(
cwd
)
dname
=
os
.
path
.
dirname
(
self
.
host_list
)
if
dname
is
None
or
dname
==
''
or
dname
==
'.'
:
cwd
=
os
.
getcwd
()
dname
=
cwd
return
os
.
path
.
abspath
(
dname
)
return
os
.
path
.
abspath
(
dname
)
def
src
(
self
):
def
src
(
self
):
...
@@ -636,6 +640,7 @@ class Inventory(object):
...
@@ -636,6 +640,7 @@ class Inventory(object):
basedirs
=
[
self
.
_playbook_basedir
]
basedirs
=
[
self
.
_playbook_basedir
]
for
basedir
in
basedirs
:
for
basedir
in
basedirs
:
display
.
debug
(
'getting vars from
%
s'
%
basedir
)
# this can happen from particular API usages, particularly if not run
# this can happen from particular API usages, particularly if not run
# from /usr/bin/ansible-playbook
# from /usr/bin/ansible-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