src/rest-server/deploy/legacy_user_migrate.py [84:119]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    def list_all_secrets_from_namespace(self, namespace):
        if self.in_cluster:
            config.load_incluster_config()
        else:
            config.load_kube_config(config_file="~/.kube/config")
        try:
            api_instance = client.CoreV1Api()
            api_response = api_instance.list_namespaced_secret(namespace)
            return api_response.items
        except ApiException as e:
            if e.status == 404:
                return []
            logger.error('Exception when calling CoreV1Api->list_namespaced_secret: %s\n' % e)
            sys.exit(1)

    def create_group_if_not_exist(self, name):
        if self.in_cluster:
            config.load_incluster_config()
        else:
            config.load_kube_config(config_file="~/.kube/config")
        try:
            api_instance = client.CoreV1Api()
            api_instance.read_namespace(name)
        except ApiException as e:
            if e.status == 404:
                api_instance = client.CoreV1Api()
                meta_data = client.V1ObjectMeta()
                meta_data.name = name
                body = client.V1Namespace(
                  metadata=meta_data
                )
                api_instance.create_namespace(body)
                return True
            logger.error("Failed to create namespace [{0}]".format(name))
            sys.exit(1)
        return False
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



src/rest-server/deploy/user_v2_migrate.py [158:193]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    def list_all_secrets_from_namespace(self, namespace):
        if self.in_cluster:
            config.load_incluster_config()
        else:
            config.load_kube_config(config_file="~/.kube/config")
        try:
            api_instance = client.CoreV1Api()
            api_response = api_instance.list_namespaced_secret(namespace)
            return api_response.items
        except ApiException as e:
            if e.status == 404:
                return []
            logger.error('Exception when calling CoreV1Api->list_namespaced_secret: %s\n' % e)
            sys.exit(1)

    def create_group_if_not_exist(self, name):
        if self.in_cluster:
            config.load_incluster_config()
        else:
            config.load_kube_config(config_file="~/.kube/config")
        try:
            api_instance = client.CoreV1Api()
            api_instance.read_namespace(name)
        except ApiException as e:
            if e.status == 404:
                api_instance = client.CoreV1Api()
                meta_data = client.V1ObjectMeta()
                meta_data.name = name
                body = client.V1Namespace(
                  metadata=meta_data
                )
                api_instance.create_namespace(body)
                return True
            logger.error("Failed to create namespace [{0}]".format(name))
            sys.exit(1)
        return False
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



