Esempio n. 1
0
    def run_with_helm(self, operation):
        err_msg = ""

        with bcs_client.make_helm_client(
            project_id=self.helm_args.project_id,
            cluster_id=self.helm_args.cluster_id,
            access_token=self.access_token,
        ) as (client, err):
            if err is not None:
                err_msg = f"make helm client failed: {err}"

            if not err_msg:
                try:
                    self._run_with_helm(client, operation)
                except Exception as e:
                    err_msg = f"helm {operation} failed: {e}"

        if err_msg:
            raise error_codes.ComponentError(err_msg)
Esempio n. 2
0
 def make_helm_client(self):
     with bcs_client.make_helm_client(
             project_id=self.app.project_id,
             cluster_id=self.app.cluster_id,
             access_token=self.access_token) as (client, err):
         yield client, err