Merge pull request #1005 from dagwieers/cmdline

Add /proc/cmdline information to the default facts
pull/1003/merge
Michael DeHaan 12 years ago
commit 49bef3f6c2

@ -58,6 +58,7 @@ class Facts(object):
self.facts = {} self.facts = {}
self.get_platform_facts() self.get_platform_facts()
self.get_distribution_facts() self.get_distribution_facts()
self.get_cmdline()
self.get_public_ssh_host_keys() self.get_public_ssh_host_keys()
self.get_selinux_facts() self.get_selinux_facts()
@ -103,6 +104,17 @@ class Facts(object):
else: else:
self.facts['distribution'] = name self.facts['distribution'] = name
def get_cmdline(self):
data = get_file_content('/proc/cmdline')
if data:
self.facts['cmdline'] = {}
for piece in shlex.split(data):
item = piece.split('=', 1)
if len(item) == 1:
self.facts['cmdline'][item[0]] = True
else:
self.facts['cmdline'][item[0]] = item[1]
def get_public_ssh_host_keys(self): def get_public_ssh_host_keys(self):
dsa_filename = '/etc/ssh/ssh_host_dsa_key.pub' dsa_filename = '/etc/ssh/ssh_host_dsa_key.pub'
rsa_filename = '/etc/ssh/ssh_host_rsa_key.pub' rsa_filename = '/etc/ssh/ssh_host_rsa_key.pub'
@ -204,7 +216,7 @@ class LinuxHardware(Hardware):
MEMORY_FACTS = ['MemTotal', 'SwapTotal', 'MemFree', 'SwapFree'] MEMORY_FACTS = ['MemTotal', 'SwapTotal', 'MemFree', 'SwapFree']
# DMI bits # DMI bits
DMI_DICT = dict( DMI_DICT = dict(
form_factor = '/sys/devices/virtual/dmi/id/chassis_type', form_factor = '/sys/devices/virtual/dmi/id/chassis_type',
product_name = '/sys/devices/virtual/dmi/id/product_name', product_name = '/sys/devices/virtual/dmi/id/product_name',
product_serial = '/sys/devices/virtual/dmi/id/product_serial', product_serial = '/sys/devices/virtual/dmi/id/product_serial',
product_uuid = '/sys/devices/virtual/dmi/id/product_uuid', product_uuid = '/sys/devices/virtual/dmi/id/product_uuid',

Loading…
Cancel
Save