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:
Alexey Elagin 2016-10-06 19:03:02 +03:00 committed by Sergii Rizvan
parent 0cfe06be93
commit 27ad2910a4
1 changed files with 2 additions and 1 deletions

3
agent
View File

@ -1212,11 +1212,12 @@ class NodeAgent
end
def _get_pci_dev_list
return {} if `cat /etc/nailgun_systemtype`.chomp != 'bootstrap'
lshw_timeout = @settings['lshw_timeout'] || 60
Timeout::timeout(lshw_timeout) do
lshw_path = `which lshw`.chomp
if $?.success?
data = `#{lshw_path} -json`
data = `#{lshw_path} -json -sanitize`
return JSON.parse(data) if $?.success?
@logger.warn("Can't get data from lshw. Reason: lshw exited with status #{$?.exitstatus}")
else