Operation not permitted while Detaching ENI#950
Closed
pragya811 wants to merge 2 commits into
Closed
Conversation
ebattat
reviewed
Nov 13, 2025
| network_interface = network_interface_data[0] | ||
| tags = network_interface.get('TagSet', []) | ||
| if self.cluster_tag and not self.__is_cluster_resource(tags, self.cluster_tag): | ||
| logger.info(f'Network interface {resource_id} is not a cluster resource. Skipping deletion.') |
Member
There was a problem hiding this comment.
I think we should ask for positive and NOT negative:
if self.cluster_tag and self.__is_cluster_resource(tags, self.cluster_tag):
No need to print log for every resource that is not related to cluster, we just want to skip it.
Member
There was a problem hiding this comment.
I meant that we should check if only when self.__is_cluster_resource(tags, self.cluster_tag).
if self.cluster_tag and self.__is_cluster_resource(tags, self.cluster_tag):
in other words, if it not a cluster resource filter it out.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of change
Note: Fill x in []
Description
ERROR: botocore.exceptions.ClientError: An error occurred (OperationNotPermitted) when calling the DetachNetworkInterface operation: The network interface at device index 0 and networkCard index 0 cannot be detached.
[ERROR] 2025-11-13 06:17:19,769 - Cannot disassociate_address: eni-02042ddb8b6xxxxxx, An error occurred (OperationNotPermitted) when calling the DetachNetworkInterface operation: The network interface at device index 0 and networkCard index 0 cannot be detached.
CAUSE: Getting error for operation not permitted because the script is trying to delete eni from running/stopped instances =, which shouldn't be the case. The filtering for zombie cluster resources was not properly filtering out such instances.
FIX: Added a check to verify whether the resource has a cluster tag before proceeding with detachment.
For security reasons, all pull requests need to be approved first before running any automated CI