Skip to content

Commit

Permalink
Change to ec-services label, handle no services
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelldls committed Aug 7, 2024
1 parent f1234ef commit bae04ed
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
12 changes: 7 additions & 5 deletions src/edge_containers_cli/cmds/argo_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
2 changes: 2 additions & 0 deletions src/edge_containers_cli/cmds/k8s_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": [],
Expand Down
2 changes: 1 addition & 1 deletion tests/data/argocd.yaml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit bae04ed

Please sign in to comment.