Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to delete deployment group #261

Closed
sheshadri99 opened this issue Nov 29, 2022 · 12 comments
Closed

Unable to delete deployment group #261

sheshadri99 opened this issue Nov 29, 2022 · 12 comments

Comments

@sheshadri99
Copy link

Hi,
There are few deployment groups, which doesnot have any devices or any deployments in it, when tried to delete those groups, the below error message is shown. Ideally we should be able to delete those groups.
Is this the expected behaviour?

Error Message:

Group 4e63870a34774967b9ffb73505271931 could not be removed.
Status code: 400.
Detail error code: NotEmptyGroupCannotBeDeleted
Details: Cannot delete Group which is not empty. Please delete or retag the agents before deleting the group.

@alancshi
Copy link

Hi @sheshadri99, this message indicates that ADU thinks that the group you are trying to delete still does have devices associated with it. Are you seeing no devices in that group when you view it in the portal? If you use the ADU CLI to list the devices does it appear empty?

"az iot du device list -n -i --filter "groupId eq ''"

@josephmsft to comment if there are other things you can check as well.

@sheshadri99
Copy link
Author

Hi @alancshi, i could see there are no devices in the group when viewed through portal.
Checked through cli as well, i am getting empty list as response.

@alancshi
Copy link

@sheshadri99 that is strange, can you share your account/instance and group name? @josephmsft @Olee2021 can you please help with this investigation?

@josephmsft
Copy link

I'll take a look, please do tell us the account and instance. I'll see if I can find it from the group name alone but that will take longer.

@josephmsft
Copy link

Ok I have determined the issue. You have 1 unhealthy device that is still tagged as part of this group. Because it is unhealthy it is not listed in the device queries you're running. The deviceId is "4e63870a34774967b9ffb73505271931" and moduleId is "FirmwareModule". If you delete this device from your hub you should be able to delete the group. You can see what unhealthy devices you have by querying for unhealthy devices, although for now that API is not returning group information. I will follow up on how we can improve this scenario.

@sheshadri99
Copy link
Author

sheshadri99 commented Dec 2, 2022

Is this the expected behaviour, having unhealthy devices being tagged to a group stops us from deleting them.
Is untagging the device from group not sufficient to delete group?
Can you share if there is documentation about health of devices?

@sheshadri99
Copy link
Author

For one particular device group, when viewed from portal it has no deployments, but when tried with api it says group has 1 active deployment, when tried to delete the deployment via api, it is returning 204 and deployment is not getting deleted.

DeviceId: ACCE000000000000A20000000F23D602

@saumya318
Copy link

saumya318 commented Dec 5, 2022

We have noticed this issue with another device group as well where in we are unable to delete a group as the error messages says that there are active deployments in the group, even though via the portal the deployment is not visible.
DELETE https://aduEndpoint/deviceUpdate/aduInstance/management/groups/groupId?api-version=2022-10-01

image

On calling the get deployments by group Id API we get an empty list:
GET https://aduEndpoint/deviceUpdate/aduInstance/management/groups/groupId/deployments?api-version=2022-10-01

image

However on calling the GET group details API, we get the deployment Id in the response:
GET https://aduEndpoint/deviceUpdate/aduInstance/management/groups/groupId?api-version=2022-10-01

image
When we try to delete this deployment using API:
DELETE https://aduEndpoint/deviceUpdate/aduInstance/management/groups/groupId/deployments/ce681527-3101-47d6-853c-b9c1737fb5fa/?api-version=2022-10-01
We get 204 No Content but post that when we try to delete the group again we still get 400 BadREquest with error as:

{
    "error": {
        "code": "GroupWithActiveDeploymentCannotBeDeleted",
        "message": "Cannot delete Group with an Active deployment. Please delete or cancel the deployment before deleting the group."
    }
}

@josephmsft
Copy link

josephmsft commented Dec 5, 2022

Is this the expected behaviour, having unhealthy devices being tagged to a group stops us from deleting them. Is untagging the device from group not sufficient to delete group? Can you share if there is documentation about health of devices?

This is currently the expected behavior, I am following up with the team if we want to make any changes here since it seems that it's hard to diagnose what is causing the failure with the current behavior.

Untagging the unhealthy device should also work to be able to delete the group.

@josephmsft
Copy link

Is this the expected behaviour, having unhealthy devices being tagged to a group stops us from deleting them. Is untagging the device from group not sufficient to delete group? Can you share if there is documentation about health of devices?

Untagging the unhealthy device should also work to be able to delete the group.

https://learn.microsoft.com/en-us/azure/iot-hub-device-update/device-update-agent-check?tabs=portal is the documentation for agent check

@josephmsft
Copy link

We have noticed this issue with another device group as well where in we are unable to delete a group as the error messages says that there are active deployments in the group, even though via the portal the deployment is not visible. DELETE https://aduEndpoint/deviceUpdate/aduInstance/management/groups/groupId?api-version=2022-10-01

image

On calling the get deployments by group Id API we get an empty list: GET https://aduEndpoint/deviceUpdate/aduInstance/management/groups/groupId/deployments?api-version=2022-10-01

image

However on calling the GET group details API, we get the deployment Id in the response: GET https://aduEndpoint/deviceUpdate/aduInstance/management/groups/groupId?api-version=2022-10-01

image When we try to delete this deployment using API: DELETE https://aduEndpoint/deviceUpdate/aduInstance/management/groups/groupId/deployments/ce681527-3101-47d6-853c-b9c1737fb5fa/?api-version=2022-10-01 We get 204 No Content but post that when we try to delete the group again we still get 400 BadREquest with error as:

{
    "error": {
        "code": "GroupWithActiveDeploymentCannotBeDeleted",
        "message": "Cannot delete Group with an Active deployment. Please delete or cancel the deployment before deleting the group."
    }
}

I have investigated and this is due to a bug in the service. Your group currently has no subgroups, but it does have a deployment. In this scenario with no subgroups we are not correctly updating the group record to remove the active deployment when DELETE deployment is called. I will work on a fix and it should be deployed by late next week, after which you should be able to fully delete the deployment by calling DELETE deployment.

@josephmsft
Copy link

This was deployed the following week from my last comment. Closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants