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
6bceee9a
Commit
6bceee9a
authored
Aug 12, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
now lvs/vg facts are only attempted if binary found
parent
c7dde72a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
19 deletions
+17
-19
lib/ansible/module_utils/facts.py
+17
-19
No files found.
lib/ansible/module_utils/facts.py
View file @
6bceee9a
...
...
@@ -1073,33 +1073,31 @@ class LinuxHardware(Hardware):
""" Get LVM Facts if running as root and lvm utils are available """
if
os
.
getuid
()
==
0
and
module
.
get_bin_path
(
'vgs'
):
vgs_path
=
module
.
get_bin_path
(
'vgs'
)
lvs_path
=
module
.
get_bin_path
(
'lvs'
)
lvm_util_options
=
'--noheadings --nosuffix --units g'
vgs_path
=
module
.
get_bin_path
(
'vgs'
)
#vgs fields: VG #PV #LV #SN Attr VSize VFree
vgs
=
{}
rc
,
vg_lines
,
err
=
module
.
run_command
(
'
%
s
%
s'
%
(
vgs_path
,
lvm_util_options
))
for
vg_line
in
vg_lines
.
splitlines
():
items
=
vg_line
.
split
()
vgs
[
items
[
0
]]
=
{
'size_g'
:
items
[
-
2
],
'free_g'
:
items
[
-
1
],
'num_lvs'
:
items
[
2
],
'num_pvs'
:
items
[
1
]}
if
vgs_path
:
rc
,
vg_lines
,
err
=
module
.
run_command
(
'
%
s
%
s'
%
(
vgs_path
,
lvm_util_options
))
for
vg_line
in
vg_lines
.
splitlines
():
items
=
vg_line
.
split
()
vgs
[
items
[
0
]]
=
{
'size_g'
:
items
[
-
2
],
'free_g'
:
items
[
-
1
],
'num_lvs'
:
items
[
2
],
'num_pvs'
:
items
[
1
]}
lvs_path
=
module
.
get_bin_path
(
'lvs'
)
#lvs fields:
#LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
lvs
=
{}
rc
,
lv_lines
,
err
=
module
.
run_command
(
'
%
s
%
s'
%
(
lvs_path
,
lvm_util_options
))
for
lv_line
in
lv_lines
.
splitlines
():
items
=
lv_line
.
split
()
lvs
[
items
[
0
]]
=
{
'size_g'
:
items
[
3
],
'vg'
:
items
[
1
]}
self
.
facts
[
'lvm'
]
=
{
'lvs'
:
lvs
,
'vgs'
:
vgs
}
if
lvs_path
:
rc
,
lv_lines
,
err
=
module
.
run_command
(
'
%
s
%
s'
%
(
lvs_path
,
lvm_util_options
))
for
lv_line
in
lv_lines
.
splitlines
():
items
=
lv_line
.
split
()
lvs
[
items
[
0
]]
=
{
'size_g'
:
items
[
3
],
'vg'
:
items
[
1
]}
self
.
facts
[
'lvm'
]
=
{
'lvs'
:
lvs
,
'vgs'
:
vgs
}
class
SunOSHardware
(
Hardware
):
...
...
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