Skip to content

Commit f9ce5ac

Browse files
authored
Merge pull request #32 from thin-edge/fix-container-group-service-type
fix(container-group): fix the service type when publishing the down status
2 parents 855bc54 + 1d694ec commit f9ce5ac

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

docs/TELEMETRY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ The following properties are stored on the service managed object.
8383
"serviceName": "tedge",
8484
"state": "running",
8585
},
86-
"name": "tedge-device::tedge",
86+
"name": "tedge-device@tedge",
8787
"serviceType": "container-group",
8888
"status": "up",
8989
"type": "c8y_Service",

src/container-group

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ case "$COMMAND" in
202202
# TODO: service monitoring does not support deleting a service
203203
# so at least mark it as uninstalled
204204
if command -V tedge >/dev/null 2>&1; then
205-
for item in $(docker ps -a --filter "label=com.docker.compose.project=$MODULE_NAME" --format "{{.Label \"com.docker.compose.project\" }}::{{.Label \"com.docker.compose.service\" }}"); do
206-
if [ "$item" != "::" ]; then
205+
for item in $(docker ps -a --filter "label=com.docker.compose.project=$MODULE_NAME" --format "{{.Label \"com.docker.compose.project\" }}@{{.Label \"com.docker.compose.service\" }}"); do
206+
if [ "$item" != "@" ]; then
207207
log "Updating health endpoint status to uninstalled. service=$item"
208208
MESSAGE="$(printf '{"status":"uninstalled","type":"%s"}' "${GROUP_SERVICE_TYPE:-"container-group"}" )"
209209
publish_health "$item" "$MESSAGE" ||:

tests/operations.robot

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ Install container-group package
2323
${operation}= Cumulocity.Execute Shell Command wget -O- nginx:80
2424
Operation Should Be SUCCESSFUL ${operation}
2525
Should Contain ${operation.to_json()["c8y_Command"]["result"]} Welcome to nginx
26+
Cumulocity.Should Have Services name=nginx@nginx service_type=container-group status=up
2627

2728
Uninstall container-group
2829
${operation}= Cumulocity.Uninstall Software {"name": "nginx", "version": "1.0.0", "softwareType": "container-group"}
2930
Operation Should Be SUCCESSFUL ${operation}
3031
Device Should Not Have Installed Software nginx
32+
Cumulocity.Should Have Services name=nginx@nginx service_type=container-group status=uninstalled
3133

3234
Install container package
3335
${operation}= Cumulocity.Install Software {"name": "webserver", "version": "httpd:2.4", "softwareType": "container"}

0 commit comments

Comments
 (0)