diff --git a/src/edge_containers_cli/cmds/argo_commands.py b/src/edge_containers_cli/cmds/argo_commands.py index fc8660f8..e820b71c 100644 --- a/src/edge_containers_cli/cmds/argo_commands.py +++ b/src/edge_containers_cli/cmds/argo_commands.py @@ -80,17 +80,19 @@ def _get_logs(self, service_name, prev) -> str: def _get_services(self, running_only) -> ServicesDataFrame: project, app = extract_project_app(self.target) - app_resp = shell.run_command( - f'argocd app list -l "edge-service=True" --project {project} -o yaml', - ) - app_dicts = YAML(typ="safe").load(app_resp) - service_data = { "name": [], # type: ignore "version": [], "ready": [], "deployed": [], } + app_resp = shell.run_command( + f'argocd app list -l "ec-service=True" --project {project} -o yaml', + ) + app_dicts = YAML(typ="safe").load(app_resp) + + if not app_dicts: + raise CommandError(f"No ec-services found in {self.target}") for app in app_dicts: resources_dict = app["status"]["resources"] diff --git a/src/edge_containers_cli/cmds/k8s_commands.py b/src/edge_containers_cli/cmds/k8s_commands.py index 34fd0cb5..e6093fa6 100644 --- a/src/edge_containers_cli/cmds/k8s_commands.py +++ b/src/edge_containers_cli/cmds/k8s_commands.py @@ -119,6 +119,8 @@ def _get_services(self, running_only): f'kubectl get statefulset -l "is_ioc==true" -n {self.target} -o yaml', ) sts_dicts = YAML(typ="safe").load(kubectl_res) + if not sts_dicts["items"]: + raise CommandError(f"No ec-services found in {self.target}") service_data = { "name": [], # type: ignore "ready": [], diff --git a/tests/data/argocd.yaml b/tests/data/argocd.yaml index c5e04807..17f12aef 100644 --- a/tests/data/argocd.yaml +++ b/tests/data/argocd.yaml @@ -1,7 +1,7 @@ checks: - cmd: argocd app get project/bl01t rsp: "" - - cmd: argocd app list -l "edge-service=True" --project project -o yaml + - cmd: argocd app list -l "ec-service=True" --project project -o yaml rsp: | - metadata: creationTimestamp: "2024-07-12T13:42:50Z"