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
a581077b
Commit
a581077b
authored
May 29, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'facter-fix' of
git://github.com/flyapen/ansible
into devel
parents
2908687a
c5b40ca2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
library/system/setup
+15
-9
No files found.
library/system/setup
View file @
a581077b
...
@@ -120,7 +120,7 @@ class Facts(object):
...
@@ -120,7 +120,7 @@ class Facts(object):
{
'path'
:
'/bin/opkg'
,
'name'
:
'opkg'
},
{
'path'
:
'/bin/opkg'
,
'name'
:
'opkg'
},
{
'path'
:
'/opt/local/bin/pkgin'
,
'name'
:
'pkgin'
},
{
'path'
:
'/opt/local/bin/pkgin'
,
'name'
:
'pkgin'
},
{
'path'
:
'/opt/local/bin/port'
,
'name'
:
'macports'
},
{
'path'
:
'/opt/local/bin/port'
,
'name'
:
'macports'
},
{
'path'
:
'/sbin/apk'
,
'name'
:
'apk'
},
{
'path'
:
'/sbin/apk'
,
'name'
:
'apk'
},
]
]
def
__init__
(
self
):
def
__init__
(
self
):
...
@@ -1143,7 +1143,7 @@ class LinuxNetwork(Network):
...
@@ -1143,7 +1143,7 @@ class LinuxNetwork(Network):
)
)
for
path
in
glob
.
glob
(
'/sys/class/net/*'
):
for
path
in
glob
.
glob
(
'/sys/class/net/*'
):
if
not
os
.
path
.
isdir
(
path
):
if
not
os
.
path
.
isdir
(
path
):
continue
continue
device
=
os
.
path
.
basename
(
path
)
device
=
os
.
path
.
basename
(
path
)
interfaces
[
device
]
=
{
'device'
:
device
}
interfaces
[
device
]
=
{
'device'
:
device
}
...
@@ -1190,7 +1190,7 @@ class LinuxNetwork(Network):
...
@@ -1190,7 +1190,7 @@ class LinuxNetwork(Network):
output
=
subprocess
.
Popen
([
ip_path
,
'addr'
,
'show'
,
device
],
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
.
communicate
()[
0
]
output
=
subprocess
.
Popen
([
ip_path
,
'addr'
,
'show'
,
device
],
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
.
communicate
()[
0
]
for
line
in
output
.
split
(
'
\n
'
):
for
line
in
output
.
split
(
'
\n
'
):
if
not
line
:
if
not
line
:
continue
continue
words
=
line
.
split
()
words
=
line
.
split
()
if
words
[
0
]
==
'inet'
:
if
words
[
0
]
==
'inet'
:
...
@@ -1259,7 +1259,7 @@ class GenericBsdIfconfigNetwork(Network):
...
@@ -1259,7 +1259,7 @@ class GenericBsdIfconfigNetwork(Network):
- interfaces (a list of interface names)
- interfaces (a list of interface names)
- interface_<name> dictionary of ipv4, ipv6, and mac address information.
- interface_<name> dictionary of ipv4, ipv6, and mac address information.
- all_ipv4_addresses and all_ipv6_addresses: lists of all configured addresses.
- all_ipv4_addresses and all_ipv6_addresses: lists of all configured addresses.
It currently does not define
It currently does not define
- default_ipv4 and default_ipv6
- default_ipv4 and default_ipv6
- type, mtu and network on interfaces
- type, mtu and network on interfaces
"""
"""
...
@@ -1315,7 +1315,7 @@ class GenericBsdIfconfigNetwork(Network):
...
@@ -1315,7 +1315,7 @@ class GenericBsdIfconfigNetwork(Network):
continue
continue
rc
,
out
,
err
=
module
.
run_command
(
command
[
v
])
rc
,
out
,
err
=
module
.
run_command
(
command
[
v
])
if
not
out
:
if
not
out
:
# v6 routing may result in
# v6 routing may result in
# RTNETLINK answers: Invalid argument
# RTNETLINK answers: Invalid argument
continue
continue
lines
=
out
.
split
(
'
\n
'
)
lines
=
out
.
split
(
'
\n
'
)
...
@@ -1713,11 +1713,17 @@ def run_setup(module):
...
@@ -1713,11 +1713,17 @@ def run_setup(module):
for
(
k
,
v
)
in
facts
.
items
():
for
(
k
,
v
)
in
facts
.
items
():
setup_options
[
"ansible_
%
s"
%
k
.
replace
(
'-'
,
'_'
)]
=
v
setup_options
[
"ansible_
%
s"
%
k
.
replace
(
'-'
,
'_'
)]
=
v
# Look for the path to the facter and ohai binary and set
# the variable to that path.
facter_path
=
module
.
get_bin_path
(
'facter'
)
ohai_path
=
module
.
get_bin_path
(
'ohai'
)
# if facter is installed, and we can use --json because
# if facter is installed, and we can use --json because
# ruby-json is ALSO installed, include facter data in the JSON
# ruby-json is ALSO installed, include facter data in the JSON
if
os
.
path
.
exists
(
"/usr/bin/facter"
)
:
if
facter_path
is
not
None
:
rc
,
out
,
err
=
module
.
run_command
(
"/usr/bin/facter
--json"
)
rc
,
out
,
err
=
module
.
run_command
(
facter_path
+
"
--json"
)
facter
=
True
facter
=
True
try
:
try
:
facter_ds
=
json
.
loads
(
out
)
facter_ds
=
json
.
loads
(
out
)
...
@@ -1731,8 +1737,8 @@ def run_setup(module):
...
@@ -1731,8 +1737,8 @@ def run_setup(module):
# because it contains a lot of nested stuff we can't use for
# because it contains a lot of nested stuff we can't use for
# templating w/o making a nicer key for it (TODO)
# templating w/o making a nicer key for it (TODO)
if
o
s
.
path
.
exists
(
"/usr/bin/ohai"
)
:
if
o
hai_path
is
not
None
:
rc
,
out
,
err
=
module
.
run_command
(
"/usr/bin/ohai"
)
rc
,
out
,
err
=
module
.
run_command
(
ohai_path
)
ohai
=
True
ohai
=
True
try
:
try
:
ohai_ds
=
json
.
loads
(
out
)
ohai_ds
=
json
.
loads
(
out
)
...
...
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