Skip to content

Operation not permitted while Detaching ENI#950

Closed
pragya811 wants to merge 2 commits into
redhat-performance:mainfrom
pragya811:cannot-detach-eni
Closed

Operation not permitted while Detaching ENI#950
pragya811 wants to merge 2 commits into
redhat-performance:mainfrom
pragya811:cannot-detach-eni

Conversation

@pragya811

Copy link
Copy Markdown
Member

Type of change

Note: Fill x in []

  • bug
  • enhancement
  • documentation
  • dependencies

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

@pragya811 pragya811 self-assigned this Nov 13, 2025
@pragya811 pragya811 added the ok-to-test PR ok to test label Nov 13, 2025
@pragya811 pragya811 requested a review from ebattat November 13, 2025 12:38
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.')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the logs

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@pragya811 pragya811 closed this Nov 19, 2025
@github-project-automation github-project-automation Bot moved this from In progress to Done in Cloud-Governance project Nov 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test PR ok to test

Projects

Development

Successfully merging this pull request may close these issues.

2 participants