Merge pull request #2138 from bcoca/2137_fix_setup_bsdjails

fixes freebsd setup issues with jails
This commit is contained in:
Michael DeHaan 2013-02-20 05:29:45 -08:00
commit 7834d021b9

View file

@ -559,13 +559,10 @@ class FreeBSDHardware(Hardware):
rc, out, err = module.run_command("/sbin/sysctl -n hw.ncpu")
self.facts['processor_count'] = out.strip()
try:
dmesg_boot = open(FreeBSDHardware.DMESG_BOOT)
except IOError:
rc, out, err = module.run_command("/sbin/dmesg")
dmesg_boot = out
for line in dmesg_boot.readlines():
dmesg_boot = get_file_content(FreeBSDHardware.DMESG_BOOT)
if not dmesg_boot:
rc, dmesg_boot, err = module.run_command("/sbin/dmesg")
for line in dmesg_boot.split('\n'):
if 'CPU:' in line:
cpu = re.sub(r'CPU:\s+', r"", line)
self.facts['processor'].append(cpu.strip())
@ -600,6 +597,7 @@ class FreeBSDHardware(Hardware):
def get_mount_facts(self):
self.facts['mounts'] = []
fstab = get_file_content('/etc/fstab')
if fstab:
for line in fstab.split('\n'):
if line.startswith('#') or line.strip() == '':
continue