From 7a5076c8b841df80692ce7760c2a7b3b49a1cfe1 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Wed, 30 Jul 2014 14:47:50 -0500 Subject: [PATCH] Catching shlex splitting error in fact gathering get_cmdline call Fixes #8352 --- lib/ansible/module_utils/facts.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index 98e88bc4cd..c1eaaaa722 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -327,12 +327,15 @@ class Facts(object): 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] + try: + 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] + except ValueError, e: + pass def get_public_ssh_host_keys(self): dsa_filename = '/etc/ssh/ssh_host_dsa_key.pub'