def wait_until_upgrade_state_is(self, state, may_fail=False):
        state = find_fumi_upgrade_state(state)
        bank = self._selected_fumi_bank()
        start_time = time.time()
        while time.time() < start_time + self._timeout:
            try:
                _state = bank.status()
            except SaHpiError:
                if may_fail:
                    time.sleep(self._poll_interval)
                    continue
                else:
                    raise
            self._debug('Current upgrade state is %s' %
                    fumi_upgrade_status_str(_state))
            if _state == state:
                return
            time.sleep(self._poll_interval)

        raise AssertionError('Upgrade state %s not reached %s.'
                % (fumi_upgrade_status_str(state),
                    secs_to_timestr(self._timeout)))
Esempio n. 2
0
def print_fumi_status(status):
    print '  FUMI update status is %s (%d).' % (fumi_upgrade_status_str(status), status)