فهرست منبع

AMBARI-15836. On debian7 UI shows 'os not supported' in processor info (aonishuk)

Andrew Onishuk 9 سال پیش
والد
کامیت
6eeb1a65c8
1فایلهای تغییر یافته به همراه8 افزوده شده و 4 حذف شده
  1. 8 4
      ambari-agent/src/main/python/ambari_agent/Facter.py

+ 8 - 4
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