@logging.log_task_wrapper(LOG.info, _("Enter context: `custom_image`"))
    def setup(self):
        """Creates custom image(s) with preinstalled applications.

        When admin is present creates one public image that is usable
        from all the tenants and users. Otherwise create one image
        per user and tenant.
        """

        if self.context in "admin":
            # NOTE(pboldin): Create by first user and make it public by
            #                the admin
            user = self.context["users"][0]
            tenant = self.context["tenants"][user["tenant_id"]]

            nics = None
            if "networks" in tenant:
                nics = [{"net-id": tenant["networks"][0]["id"]}]

            custom_image = self.create_one_image(user, nics=nics)
            self.make_image_public(custom_image)

            for tenant in self.context["tenants"].values():
                tenant["custom_image"] = custom_image
        else:
            def publish(queue):
                users = self.context.get("users", [])
                for user, tenant_id in utils.iterate_per_tenants(users):
                    queue.append((user, tenant_id))

            def consume(cache, args):
                user, tenant_id = args
                tenant = self.context["tenants"][tenant_id]
                tenant["custom_image"] = self.create_one_image(user)

            broker.run(publish, consume, self.config["workers"])
dataset/ETHPy150Open openstack/rally/rally/plugins/openstack/context/vm/custom_image.py/BaseCustomImageGenerator.setup/swapped operands of `in`