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
cf289191
Commit
cf289191
authored
Sep 17, 2015
by
Alex Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
return None if group does not exist in inventory groups
parent
cc6627cd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
5 deletions
+8
-5
lib/ansible/inventory/__init__.py
+4
-1
lib/ansible/plugins/strategy/__init__.py
+4
-4
No files found.
lib/ansible/inventory/__init__.py
View file @
cf289191
...
@@ -457,7 +457,10 @@ class Inventory(object):
...
@@ -457,7 +457,10 @@ class Inventory(object):
return
matching_host
return
matching_host
def
get_group
(
self
,
groupname
):
def
get_group
(
self
,
groupname
):
return
self
.
groups
[
groupname
]
if
groupname
in
self
.
groups
:
return
self
.
groups
[
groupname
]
else
:
return
None
def
get_group_variables
(
self
,
groupname
,
update_cached
=
False
,
vault_password
=
None
):
def
get_group_variables
(
self
,
groupname
,
update_cached
=
False
,
vault_password
=
None
):
if
groupname
not
in
self
.
_vars_per_group
or
update_cached
:
if
groupname
not
in
self
.
_vars_per_group
or
update_cached
:
...
...
lib/ansible/plugins/strategy/__init__.py
View file @
cf289191
...
@@ -356,10 +356,10 @@ class StrategyBase:
...
@@ -356,10 +356,10 @@ class StrategyBase:
new_group
.
add_host
(
new_host
)
new_group
.
add_host
(
new_host
)
# add this host to the group cache
# add this host to the group cache
if
self
.
_inventory
.
_groups_list
is
not
None
:
if
self
.
_inventory
.
groups
is
not
None
:
if
group_name
in
self
.
_inventory
.
_groups_list
:
if
group_name
in
self
.
_inventory
.
groups
:
if
new_host
.
name
not
in
self
.
_inventory
.
_groups_list
[
group_name
]
:
if
new_host
not
in
self
.
_inventory
.
get_group
(
group_name
)
.
hosts
:
self
.
_inventory
.
_groups_list
[
group_name
]
.
append
(
new_host
.
name
)
self
.
_inventory
.
get_group
(
group_name
)
.
hosts
.
append
(
new_host
.
name
)
# clear pattern caching completely since it's unpredictable what
# clear pattern caching completely since it's unpredictable what
# patterns may have referenced the group
# patterns may have referenced the group
...
...
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