Change _get_pci_dev_list func
Add hostname check and run lshw only on bootstrap nodes.
Add sanitize param to lshw to hide any ip,mac etc
Change-Id: I7739da68ab059178787ff0fe2418a54717684750
Closes-Bug: #1554970
(cherry picked from commit 1dd3dd64bf
)
This commit is contained in:
parent
0cfe06be93
commit
27ad2910a4
3
agent
3
agent
|
@ -1212,11 +1212,12 @@ class NodeAgent
|
||||||
end
|
end
|
||||||
|
|
||||||
def _get_pci_dev_list
|
def _get_pci_dev_list
|
||||||
|
return {} if `cat /etc/nailgun_systemtype`.chomp != 'bootstrap'
|
||||||
lshw_timeout = @settings['lshw_timeout'] || 60
|
lshw_timeout = @settings['lshw_timeout'] || 60
|
||||||
Timeout::timeout(lshw_timeout) do
|
Timeout::timeout(lshw_timeout) do
|
||||||
lshw_path = `which lshw`.chomp
|
lshw_path = `which lshw`.chomp
|
||||||
if $?.success?
|
if $?.success?
|
||||||
data = `#{lshw_path} -json`
|
data = `#{lshw_path} -json -sanitize`
|
||||||
return JSON.parse(data) if $?.success?
|
return JSON.parse(data) if $?.success?
|
||||||
@logger.warn("Can't get data from lshw. Reason: lshw exited with status #{$?.exitstatus}")
|
@logger.warn("Can't get data from lshw. Reason: lshw exited with status #{$?.exitstatus}")
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue