def wait_for_idle(runner, timeout=None): """ Run waiting command. Raise LibraryError if command failed. runner is preconfigured object for running external programs string timeout is waiting timeout """ args = [__exec("crm_resource"), "--wait"] if timeout is not None: args.append("--timeout={0}".format(timeout)) stdout, stderr, retval = runner.run(args) if retval != 0: # Usefull info goes to stderr - not only error messages, a list of # pending actions in case of timeout goes there as well. # We use stdout just to be sure if that's get changed. if retval == __EXITCODE_WAIT_TIMEOUT: raise LibraryError( reports.wait_for_idle_timed_out( join_multilines([stderr, stdout]) ) ) raise LibraryError( reports.wait_for_idle_error( join_multilines([stderr, stdout]) ) )
def wait_for_idle(runner, timeout=None): """ Run waiting command. Raise LibraryError if command failed. runner is preconfigured object for running external programs string timeout is waiting timeout """ args = [__exec("crm_resource"), "--wait"] if timeout is not None: args.append("--timeout={0}".format(timeout)) stdout, stderr, retval = runner.run(args) if retval != 0: # Usefull info goes to stderr - not only error messages, a list of # pending actions in case of timeout goes there as well. # We use stdout just to be sure if that's get changed. if retval == __EXITCODE_WAIT_TIMEOUT: raise LibraryError( reports.wait_for_idle_timed_out( join_multilines([stderr, stdout]) ) ) else: raise LibraryError( reports.wait_for_idle_error( join_multilines([stderr, stdout]) ) )