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
121d7c4e
Commit
121d7c4e
authored
May 08, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #329 from skvidal/devel
inventory and indentation
parents
1af461f4
cd28d826
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
lib/ansible/inventory.py
+10
-10
No files found.
lib/ansible/inventory.py
View file @
121d7c4e
...
...
@@ -73,14 +73,14 @@ class Inventory(object):
hosts
=
{}
patterns
=
pattern
.
replace
(
";"
,
":"
)
.
split
(
":"
)
for
group
in
self
.
get_group
s
():
for
host
in
group
.
get_hosts
():
for
pat
in
patterns
:
if
group
.
name
==
pat
or
pat
==
'all'
or
self
.
_match
(
host
.
name
,
pat
):
if
not
self
.
_restriction
:
hosts
[
host
.
name
]
=
host
if
self
.
_restriction
and
host
.
name
in
self
.
_restriction
:
hosts
[
host
.
name
]
=
host
for
(
groupname
,
group
)
in
self
.
get_groups
()
.
item
s
():
for
host
in
group
.
get_hosts
():
for
pat
in
patterns
:
if
group
.
name
==
pat
or
pat
==
'all'
or
self
.
_match
(
host
.
name
,
pat
):
if
not
self
.
_restriction
:
hosts
[
host
.
name
]
=
host
if
self
.
_restriction
and
host
.
name
in
self
.
_restriction
:
hosts
[
host
.
name
]
=
host
return
sorted
(
hosts
.
values
(),
key
=
lambda
x
:
x
.
name
)
def
get_groups
(
self
):
...
...
@@ -88,8 +88,8 @@ class Inventory(object):
def
get_host
(
self
,
hostname
):
for
group
in
self
.
groups
:
for
host
in
group
.
get_hosts
():
if
hostname
==
host
.
name
:
for
host
in
group
.
get_hosts
():
if
hostname
==
host
.
name
:
return
host
return
None
...
...
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