From ac92fb02d0049cd5735a51849fe490bf9092fbd1 Mon Sep 17 00:00:00 2001 From: Ross Brattain Date: Mon, 27 Jun 2016 17:35:57 -0700 Subject: use pgrep instead of ps 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 --- deploy/install_fuel_master.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'deploy') diff --git a/deploy/install_fuel_master.py b/deploy/install_fuel_master.py index 808d0b14c..a0e28b033 100644 --- a/deploy/install_fuel_master.py +++ b/deploy/install_fuel_master.py @@ -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: -- cgit 1.2.3-korg