def services_list(request, environment_id): services = [] # need to create new session to see services deployed be other user session_id = Session.get_or_create(request, environment_id) get_environment = muranoclient(request).environments.get environment = get_environment(environment_id, session_id) try: reports = muranoclient(request).environments.last_status( environment_id, session_id) except HTTPNotFound: reports = {} for service_item in environment.services: service_data = service_item service_data['full_service_name'] = get_service_name( service_data['type']) if service_data['id'] in reports and reports[service_data['id']]: last_operation = str(reports[service_data['id']].text) time = reports[service_data['id']].updated.replace('T', ' ') else: last_operation = 'Service draft created' \ if environment.version == 0 else '' time = service_data['updated'].replace('T', ' ')[:-7] service_data['environment_id'] = environment_id service_data['environment_version'] = environment.version service_data['operation'] = last_operation service_data['operation_updated'] = time services.append(service_data) log.debug('Service::List') return [bunch.bunchify(service) for service in services]
def services_list(request, environment_id): services = [] # need to create new session to see services deployed be other user session_id = Session.get_or_create(request, environment_id) get_environment = muranoclient(request).environments.get environment = get_environment(environment_id, session_id) try: reports = muranoclient(request).environments.last_status(environment_id, session_id) except HTTPNotFound: reports = {} for service_item in environment.services: service_data = service_item service_data["full_service_name"] = get_service_name(service_data["type"]) if service_data["id"] in reports and reports[service_data["id"]]: last_operation = str(reports[service_data["id"]].text) time = reports[service_data["id"]].updated.replace("T", " ") else: last_operation = "Service draft created" if environment.version == 0 else "" time = service_data["updated"].replace("T", " ")[:-7] service_data["environment_id"] = environment_id service_data["environment_version"] = environment.version service_data["operation"] = last_operation service_data["operation_updated"] = time services.append(service_data) log.debug("Service::List") return [bunch.bunchify(service) for service in services]
def get_deployment_descr(request, environment_id, deployment_id): deployments = muranoclient(request).deployments.list(environment_id) for deployment in deployments: if deployment.id == deployment_id: descr = deployment.description if "services" in descr: for service in descr["services"]: service["full_service_name"] = get_service_name(service["type"]) return descr return None
def get_deployment_descr(request, environment_id, deployment_id): deployments = muranoclient(request).deployments.list(environment_id) for deployment in deployments: if deployment.id == deployment_id: descr = deployment.description if 'services' in descr: for service in descr['services']: service['full_service_name'] = get_service_name( service['type']) return descr return None
def get_context_data(self, form, **kwargs): context = super(Wizard, self).get_context_data(form=form, **kwargs) context['service_descriptions'] = get_service_descriptions() if self.steps.index > 0: data = self.get_cleaned_data_for_step('service_choice') slug = data['service'] context['field_descriptions'] = get_service_field_descriptions( slug, self.steps.index - 1) context.update({'type': get_service_client(slug), 'service_name': get_service_name(slug)}) return context
def get_context_data(self, form, **kwargs): context = super(Wizard, self).get_context_data(form=form, **kwargs) context['service_descriptions'] = get_service_descriptions() if self.steps.index > 0: data = self.get_cleaned_data_for_step('service_choice') slug = data['service'] context['field_descriptions'] = get_service_field_descriptions( slug, self.steps.index - 1) context.update({ 'type': get_service_client(slug), 'service_name': get_service_name(slug) }) return context