def get_dep_contexts(version): deps = {} tenants = [get_tenant_name()] if version < snapshot_constants.V_4_0_0 \ else get_tenants_list() for tenant_name in tenants: # Temporarily assign the context a different tenant name so that # we can retrieve that tenant's deployment contexts with internal_utils._change_tenant(ctx, tenant_name): # We have to zero this out each time or the cached version for # the previous tenant will be used ctx._dep_contexts = None # Get deployment contexts for this tenant deps[tenant_name] = ctx.deployments_contexts return deps.items()