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
aa340c15
Commit
aa340c15
authored
Jun 16, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3169 from Debilski/fix-duplicate-host-reads
Allow inventory to be read from a pipe
parents
fe984953
71afb9e4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
11 deletions
+7
-11
lib/ansible/inventory/__init__.py
+2
-6
lib/ansible/inventory/ini.py
+5
-5
No files found.
lib/ansible/inventory/__init__.py
View file @
aa340c15
...
...
@@ -90,12 +90,8 @@ class Inventory(object):
self
.
parser
=
InventoryScript
(
filename
=
host_list
)
self
.
groups
=
self
.
parser
.
groups
.
values
()
else
:
data
=
file
(
host_list
)
.
read
()
if
not
data
.
startswith
(
"---"
):
self
.
parser
=
InventoryParser
(
filename
=
host_list
)
self
.
groups
=
self
.
parser
.
groups
.
values
()
else
:
raise
errors
.
AnsibleError
(
"YAML inventory support is deprecated in 0.6 and removed in 0.7, see the migration script in examples/scripts in the git checkout"
)
self
.
parser
=
InventoryParser
(
filename
=
host_list
)
self
.
groups
=
self
.
parser
.
groups
.
values
()
utils
.
plugins
.
vars_loader
.
add_directory
(
self
.
basedir
(),
with_subdir
=
True
)
else
:
...
...
lib/ansible/inventory/ini.py
View file @
aa340c15
...
...
@@ -33,11 +33,11 @@ class InventoryParser(object):
def
__init__
(
self
,
filename
=
C
.
DEFAULT_HOST_LIST
):
fh
=
open
(
filename
)
self
.
lines
=
fh
.
readlines
()
self
.
groups
=
{}
self
.
hosts
=
{}
self
.
_parse
()
with
open
(
filename
)
as
fh
:
self
.
lines
=
fh
.
readlines
()
self
.
groups
=
{}
self
.
hosts
=
{}
self
.
_parse
()
def
_parse
(
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