def run_until_status(self, smart_nodes, status,
                         role=None, random_error=False,
                         instant=False):
        ready = False

        if random_error:
            smart_nodes[randrange(0, len(smart_nodes))].error()

        while not ready and not self.stoprequest.isSet():
            for sn in smart_nodes:
                continue_cases = (
                    sn.current in (status, consts.NODE_STATUSES.error),
                    role and
                    (('role' in sn.data and sn.data['role'] != role) or
                     ('roles' in sn.data and role not in sn.data['roles']))
                )
                if any(continue_cases):
                    continue

                if instant:
                    sn.ready()
                else:
                    sn.update_progress(
                        randrange(
                            self.low_tick_count,
                            self.tick_count
                        )
                    )

            if role:
                test_nodes = [
                    sn for sn in smart_nodes
                    if (('role' in sn.data and sn.data['role']) or
                        ('roles' in sn.data and sn.data['roles'] in role))
                ]
            else:
                test_nodes = smart_nodes

            node_ready_status = (
                (tn.current in (status, 'error'))
                for tn in test_nodes
            )

            if all(node_ready_status):
                ready = True

            yield [sn.data for sn in smart_nodes]
dataset/ETHPy150Open openstack/fuel-web/nailgun/nailgun/task/fake.py/FakeThread.run_until_status/swapped operands of `in`