fixes freebsd setup issues with jails

Signed-off-by: Brian Coca <bcoca@tablethotels.com>
This commit is contained in:
Brian Coca 2013-02-19 18:36:25 -05:00
parent 589548531e
commit aa713d72ef

View file

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