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
7c270078
Commit
7c270078
authored
Feb 21, 2013
by
Michel Blanc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved key filtering
Key filtering moved before returning results
parent
627577ec
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
11 deletions
+8
-11
library/setup
+8
-11
No files found.
library/setup
View file @
7c270078
...
...
@@ -1102,12 +1102,9 @@ def run_setup(module):
setup_options
=
{}
facts
=
ansible_facts
()
filtr
=
module
.
params
[
'filter'
]
for
(
k
,
v
)
in
facts
.
items
():
k2
=
"ansible_
%
s"
%
k
.
replace
(
'-'
,
'_'
)
if
fnmatch
.
fnmatch
(
k2
,
filtr
):
setup_options
[
k2
]
=
v
setup_options
[
"ansible_
%
s"
%
k
.
replace
(
'-'
,
'_'
)]
=
v
# if facter is installed, and we can use --json because
# ruby-json is ALSO installed, include facter data in the JSON
...
...
@@ -1121,9 +1118,7 @@ def run_setup(module):
facter
=
False
if
facter
:
for
(
k
,
v
)
in
facter_ds
.
items
():
k2
=
"facter_
%
s"
%
k
if
fnmatch
.
fnmatch
(
k2
,
filtr
):
setup_options
[
k2
]
=
v
setup_options
[
"facter_
%
s"
%
k
]
=
v
# ditto for ohai, but just top level string keys
# because it contains a lot of nested stuff we can't use for
...
...
@@ -1140,11 +1135,13 @@ def run_setup(module):
for
(
k
,
v
)
in
ohai_ds
.
items
():
if
type
(
v
)
==
str
or
type
(
v
)
==
unicode
:
k2
=
"ohai_
%
s"
%
k
.
replace
(
'-'
,
'_'
)
if
fnmatch
.
fnmatch
(
k2
,
filtr
):
setup_options
[
k2
]
=
v
setup_options
[
k2
]
=
v
setup_result
=
{
'ansible_facts'
:
{}
}
setup_result
=
{}
setup_result
[
'ansible_facts'
]
=
setup_options
for
(
k
,
v
)
in
setup_options
.
items
():
if
fnmatch
.
fnmatch
(
k
,
module
.
params
[
'filter'
]):
setup_result
[
'ansible_facts'
][
k
]
=
v
# hack to keep --verbose from showing all the setup module results
setup_result
[
'verbose_override'
]
=
True
...
...
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