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
320ce8f5
Commit
320ce8f5
authored
Feb 27, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
If ohai is present, do the same with facter and make it available for the templating engine
parent
186dab4d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
library/setup
+19
-0
No files found.
library/setup
View file @
320ce8f5
...
...
@@ -47,6 +47,25 @@ if os.path.exists("/usr/bin/facter"):
for
(
k
,
v
)
in
facter_ds
.
items
():
new_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
# templating w/o making a nicer key for it (TODO)
if
os
.
path
.
exists
(
"/usr/bin/ohai"
):
cmd
=
subprocess
.
Popen
(
"/usr/bin/ohai"
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
out
,
err
=
cmd
.
communicate
()
ohai
=
True
try
:
ohai_ds
=
json
.
loads
(
out
)
except
:
ohai
=
False
if
ohai
:
for
(
k
,
v
)
in
ohai_ds
.
items
():
if
type
(
v
)
==
str
or
type
(
v
)
==
unicode
:
k2
=
"ohai_
%
s"
%
k
new_options
[
k2
]
=
v
# write the template/settings file using
# instructions from server
...
...
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