1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Merge pull request #3259 from dirtyharrycallahan/b_setup

bug fix: modify get_device_facts to handle servers with multiple pci domains
This commit is contained in:
Michael DeHaan 2013-06-19 18:24:10 -07:00
commit 6d6df1959c

View file

@ -633,7 +633,7 @@ class LinuxHardware(Hardware):
self.facts['devices'] = {}
lspci = module.get_bin_path('lspci')
if lspci:
rc, pcidata, err = module.run_command(lspci)
rc, pcidata, err = module.run_command([lspci, '-D'])
else:
pcidata = None
@ -704,7 +704,9 @@ class LinuxHardware(Hardware):
d['size'] = module.pretty_bytes(float(d['sectors']) * float(d['sectorsize']))
d['host'] = ""
m = re.match(".+/[a-f0-9]+:([a-f0-9]+:[a-f0-9]+\.[a-f0-9]+)/host\d+/", sysdir)
# domains are numbered (0 to ffff), bus (0 to ff), slot (0 to 1f), and function (0 to 7).
m = re.match(".+/([a-f0-9]{4}:[a-f0-9]{2}:[0|1][a-f0-9]\.[0-7])/", sysdir)
if m and pcidata:
pciid = m.group(1)
did = re.escape(pciid)