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

Catching shlex splitting error in fact gathering get_cmdline call

Fixes #8352
This commit is contained in:
James Cammarata 2014-07-30 14:47:50 -05:00
parent 80df2135e9
commit 7a5076c8b8

View file

@ -327,12 +327,15 @@ class Facts(object):
data = get_file_content('/proc/cmdline') data = get_file_content('/proc/cmdline')
if data: if data:
self.facts['cmdline'] = {} self.facts['cmdline'] = {}
for piece in shlex.split(data): try:
item = piece.split('=', 1) for piece in shlex.split(data):
if len(item) == 1: item = piece.split('=', 1)
self.facts['cmdline'][item[0]] = True if len(item) == 1:
else: self.facts['cmdline'][item[0]] = True
self.facts['cmdline'][item[0]] = item[1] else:
self.facts['cmdline'][item[0]] = item[1]
except ValueError, e:
pass
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'