use pgrep instead of ps 77/17577/4
authorRoss Brattain <ross.b.brattain@intel.com>
Tue, 28 Jun 2016 00:35:57 +0000 (17:35 -0700)
committerJonas Bjurel <jonas.bjurel@ericsson.com>
Thu, 29 Sep 2016 12:06:41 +0000 (12:06 +0000)
pgrep was added to procps-ng, it is more exact

also replace ps -ef in wait_until_fuel_menu_up
removed get_fuel_menu_pid

Change-Id: I57ad9d2fabbfe5f570e0be3bfb40ef842f95902d
Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
deploy/install_fuel_master.py

index 808d0b1..a0e28b0 100644 (file)
@@ -156,13 +156,12 @@ class InstallFuelMaster(object):
     def wait_until_fuel_menu_up(self):
         WAIT_LOOP = 60
         SLEEP_TIME = 10
-        CMD = 'ps -ef'
-        SEARCH = 'fuelmenu'
+        CMD = 'pgrep -f fuelmenu'
         fuel_menu_pid = None
         with self.ssh:
             for i in range(WAIT_LOOP):
                 ret = self.ssh.exec_cmd(CMD)
-                fuel_menu_pid = self.get_fuel_menu_pid(ret, SEARCH)
+                fuel_menu_pid = ret.strip()
                 if not fuel_menu_pid:
                     time.sleep(SLEEP_TIME)
                 else:
@@ -171,11 +170,6 @@ class InstallFuelMaster(object):
             raise Exception('Could not find the Fuel Menu Process ID')
         return fuel_menu_pid
 
-    def get_fuel_menu_pid(self, printout, search):
-        for line in printout.splitlines():
-            if line.endswith(search):
-                return clean(line)[1]
-
     def ssh_exec_cmd(self, cmd, check=True):
         with self.ssh:
             ret = self.ssh.exec_cmd(cmd, check=check)
@@ -198,7 +192,7 @@ class InstallFuelMaster(object):
     def wait_until_installation_completed(self):
         WAIT_LOOP = 360
         SLEEP_TIME = 10
-        CMD = 'ps -ef | grep %s | grep -v grep' % BOOTSTRAP_ADMIN
+        CMD = 'pgrep -f %s' % BOOTSTRAP_ADMIN
 
         install_completed = False
         with self.ssh: