Repository: ambari Updated Branches: refs/heads/trunk af13ef739 -> 6eeb1a65c
AMBARI-15836. On debian7 UI shows 'os not supported' in processor info (aonishuk) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6eeb1a65 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6eeb1a65 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6eeb1a65 Branch: refs/heads/trunk Commit: 6eeb1a65c8da32f1811e10cf49f8f17540d7711b Parents: af13ef7 Author: Andrew Onishuk <aonis...@hortonworks.com> Authored: Tue Apr 12 17:15:50 2016 +0300 Committer: Andrew Onishuk <aonis...@hortonworks.com> Committed: Tue Apr 12 17:15:50 2016 +0300 ---------------------------------------------------------------------- ambari-agent/src/main/python/ambari_agent/Facter.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/6eeb1a65/ambari-agent/src/main/python/ambari_agent/Facter.py ---------------------------------------------------------------------- diff --git a/ambari-agent/src/main/python/ambari_agent/Facter.py b/ambari-agent/src/main/python/ambari_agent/Facter.py index bad9b96..7520f4c 100644 --- a/ambari-agent/src/main/python/ambari_agent/Facter.py +++ b/ambari-agent/src/main/python/ambari_agent/Facter.py @@ -41,9 +41,9 @@ log = logging.getLogger() def run_os_command(cmd): - if type(cmd) == str: - cmd = shlex.split(cmd) + shell = (type(cmd) == str) process = subprocess.Popen(cmd, + shell=shell, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE @@ -95,8 +95,12 @@ class Facter(object): # Returns the CPU hardware architecture def getArchitecture(self): result = platform.processor() - if result == '': - return 'OS NOT SUPPORTED' + if not result: + retcode, out, err = run_os_command("lscpu | grep Architecture: | awk '{ print $2 }'") + out = out.strip() + if out: + return out + return 'unknown cpu arch' else: return result