Esempio n. 1
0
 def get_logs(self):
     logs = []
     try:
         logs = api.deployment_reports(self.request, self.environment_id, self.deployment_id)
     except (exc.HTTPInternalServerError, exc.HTTPNotFound):
         msg = _("Deployment with id %s doesn't exist anymore")
         redirect = reverse("horizon:murano:environments:deployments")
         exceptions.handle(self.request, msg % self.deployment_id, redirect=redirect)
     return logs
Esempio n. 2
0
    def get_tabs(self, request, *args, **kwargs):
        try:
            deployments = api.deployments_list(self.request, self.environment_id)
        except exc.HTTPException:
            msg = _('Unable to retrieve list of deployments')
            exceptions.handle(self.request, msg, redirect=self.get_redirect_url())

        logs = []
        if deployments:
            last_deployment = deployments[0]
            logs = api.deployment_reports(self.request, self.environment_id, last_deployment.id)
        return self.tab_group_class(request, logs=logs, **kwargs)
Esempio n. 3
0
 def get_logs(self):
     logs = []
     try:
         logs = api.deployment_reports(self.request, self.environment_id,
                                       self.deployment_id)
     except (exc.HTTPInternalServerError, exc.HTTPNotFound):
         msg = _('Deployment with id %s doesn\'t exist anymore')
         redirect = reverse("horizon:murano:environments:deployments")
         exceptions.handle(self.request,
                           msg % self.deployment_id,
                           redirect=redirect)
     return logs
Esempio n. 4
0
    def get_tabs(self, request, *args, **kwargs):
        environment_id = self.kwargs['environment_id']
        ns_url = "horizon:murano:environments:index"
        try:
            deployments = api.deployments_list(self.request, environment_id)
        except exc.HTTPException:
            msg = _('Unable to retrieve list of deployments')
            exceptions.handle(self.request, msg, redirect=reverse(ns_url))

        logs = []
        if deployments:
            last_deployment = deployments[0]
            logs = api.deployment_reports(self.request, environment_id,
                                          last_deployment.id)
        return self.tab_group_class(request, logs=logs, **kwargs)
Esempio n. 5
0
    def get_tabs(self, request, *args, **kwargs):
        environment_id = self.kwargs['environment_id']
        ns_url = "horizon:murano:environments:index"
        try:
            deployments = api.deployments_list(self.request,
                                               environment_id)
        except exc.HTTPException:
            msg = _('Unable to retrieve list of deployments')
            exceptions.handle(self.request, msg, redirect=reverse(ns_url))

        logs = []
        if deployments:
            last_deployment = deployments[0]
            logs = api.deployment_reports(self.request,
                                          environment_id,
                                          last_deployment.id)
        return self.tab_group_class(request, logs=logs,
                                    **kwargs)
Esempio n. 6
0
 def test_deployment_reports(self, mock_log, mock_api):
     env_api.deployment_reports(self.mock_request, self.env_id,
                                self.deployment_id)
     env_api.api.muranoclient.assert_called_with(self.mock_request)
     self.assertTrue(mock_log.debug.called)
Esempio n. 7
0
 def test_deployment_reports(self, mock_log, mock_api):
     env_api.deployment_reports(self.mock_request, self.env_id,
                                self.deployment_id)
     env_api.api.muranoclient.assert_called_with(self.mock_request)
     self.assertTrue(mock_log.debug.called)