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
805e83d2
Commit
805e83d2
authored
Apr 27, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updating module_utils/facts.py in v2 with v1 version
parent
8d174e70
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
21 deletions
+24
-21
v2/ansible/module_utils/facts.py
+24
-21
No files found.
v2/ansible/module_utils/facts.py
View file @
805e83d2
...
...
@@ -123,20 +123,23 @@ class Facts(object):
{
'path'
:
'/usr/bin/pkg'
,
'name'
:
'pkg'
},
]
def
__init__
(
self
):
def
__init__
(
self
,
load_on_init
=
True
):
self
.
facts
=
{}
self
.
get_platform_facts
()
self
.
get_distribution_facts
()
self
.
get_cmdline
()
self
.
get_public_ssh_host_keys
()
self
.
get_selinux_facts
()
self
.
get_fips_facts
()
self
.
get_pkg_mgr_facts
()
self
.
get_lsb_facts
()
self
.
get_date_time_facts
()
self
.
get_user_facts
()
self
.
get_local_facts
()
self
.
get_env_facts
()
if
load_on_init
:
self
.
get_platform_facts
()
self
.
get_distribution_facts
()
self
.
get_cmdline
()
self
.
get_public_ssh_host_keys
()
self
.
get_selinux_facts
()
self
.
get_fips_facts
()
self
.
get_pkg_mgr_facts
()
self
.
get_lsb_facts
()
self
.
get_date_time_facts
()
self
.
get_user_facts
()
self
.
get_local_facts
()
self
.
get_env_facts
()
def
populate
(
self
):
return
self
.
facts
...
...
@@ -198,7 +201,7 @@ class Facts(object):
# if that fails, skip it
rc
,
out
,
err
=
module
.
run_command
(
fn
)
else
:
out
=
get_file_content
(
fn
)
out
=
get_file_content
(
fn
,
default
=
''
)
# load raw json
fact
=
'loading
%
s'
%
fact_base
...
...
@@ -1668,6 +1671,7 @@ class Darwin(Hardware):
if
rc
==
0
:
self
.
facts
[
'memfree_mb'
]
=
long
(
out
.
splitlines
()[
-
1
]
.
split
()[
1
])
/
1024
/
1024
class
Network
(
Facts
):
"""
This is a generic Network subclass of Facts. This should be further
...
...
@@ -1775,7 +1779,7 @@ class LinuxNetwork(Network):
device
=
os
.
path
.
basename
(
path
)
interfaces
[
device
]
=
{
'device'
:
device
}
if
os
.
path
.
exists
(
os
.
path
.
join
(
path
,
'address'
)):
macaddress
=
get_file_content
(
os
.
path
.
join
(
path
,
'address'
))
macaddress
=
get_file_content
(
os
.
path
.
join
(
path
,
'address'
)
,
default
=
''
)
if
macaddress
and
macaddress
!=
'00:00:00:00:00:00'
:
interfaces
[
device
][
'macaddress'
]
=
macaddress
if
os
.
path
.
exists
(
os
.
path
.
join
(
path
,
'mtu'
)):
...
...
@@ -1798,15 +1802,15 @@ class LinuxNetwork(Network):
interfaces
[
device
][
'type'
]
=
'bridge'
interfaces
[
device
][
'interfaces'
]
=
[
os
.
path
.
basename
(
b
)
for
b
in
glob
.
glob
(
os
.
path
.
join
(
path
,
'brif'
,
'*'
))
]
if
os
.
path
.
exists
(
os
.
path
.
join
(
path
,
'bridge'
,
'bridge_id'
)):
interfaces
[
device
][
'id'
]
=
get_file_content
(
os
.
path
.
join
(
path
,
'bridge'
,
'bridge_id'
))
interfaces
[
device
][
'id'
]
=
get_file_content
(
os
.
path
.
join
(
path
,
'bridge'
,
'bridge_id'
)
,
default
=
''
)
if
os
.
path
.
exists
(
os
.
path
.
join
(
path
,
'bridge'
,
'stp_state'
)):
interfaces
[
device
][
'stp'
]
=
get_file_content
(
os
.
path
.
join
(
path
,
'bridge'
,
'stp_state'
))
==
'1'
if
os
.
path
.
exists
(
os
.
path
.
join
(
path
,
'bonding'
)):
interfaces
[
device
][
'type'
]
=
'bonding'
interfaces
[
device
][
'slaves'
]
=
get_file_content
(
os
.
path
.
join
(
path
,
'bonding'
,
'slaves'
))
.
split
()
interfaces
[
device
][
'mode'
]
=
get_file_content
(
os
.
path
.
join
(
path
,
'bonding'
,
'mode'
))
.
split
()[
0
]
interfaces
[
device
][
'miimon'
]
=
get_file_content
(
os
.
path
.
join
(
path
,
'bonding'
,
'miimon'
))
.
split
()[
0
]
interfaces
[
device
][
'lacp_rate'
]
=
get_file_content
(
os
.
path
.
join
(
path
,
'bonding'
,
'lacp_rate'
))
.
split
()[
0
]
interfaces
[
device
][
'slaves'
]
=
get_file_content
(
os
.
path
.
join
(
path
,
'bonding'
,
'slaves'
)
,
default
=
''
)
.
split
()
interfaces
[
device
][
'mode'
]
=
get_file_content
(
os
.
path
.
join
(
path
,
'bonding'
,
'mode'
)
,
default
=
''
)
.
split
()[
0
]
interfaces
[
device
][
'miimon'
]
=
get_file_content
(
os
.
path
.
join
(
path
,
'bonding'
,
'miimon'
)
,
default
=
''
)
.
split
()[
0
]
interfaces
[
device
][
'lacp_rate'
]
=
get_file_content
(
os
.
path
.
join
(
path
,
'bonding'
,
'lacp_rate'
)
,
default
=
''
)
.
split
()[
0
]
primary
=
get_file_content
(
os
.
path
.
join
(
path
,
'bonding'
,
'primary'
))
if
primary
:
interfaces
[
device
][
'primary'
]
=
primary
...
...
@@ -2740,4 +2744,3 @@ def get_all_facts(module):
setup_result
[
'verbose_override'
]
=
True
return
setup_result
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