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

feat(apply): add support for multiple interfaces in get_intf_ip filter #405

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from

Conversation

ankitrgadiya
Copy link
Member

The get_intf_ip filter now supports a comma-separated list of network interfaces. It returns the first IP address found among the specified interfaces.

Additionally, the filter is optimized to cache results, preventing repeated network calls and ensuring better performance when used multiple times in a workflow.

@ankitrgadiya ankitrgadiya self-assigned this Dec 26, 2024
@ankitrgadiya ankitrgadiya requested review from a team as code owners December 26, 2024 14:30
The `get_intf_ip` filter now supports a comma-separated list of network
interfaces. It returns the first IP address found among the specified
interfaces.

Additionally, the filter is optimized to cache results, preventing repeated
network calls and ensuring better performance when used multiple times in a
workflow.
@ankitrgadiya ankitrgadiya force-pushed the feat/improve-get-intf-ip branch from 33c344d to bc29232 Compare December 26, 2024 14:31
Copy link

github-actions bot commented Dec 26, 2024

🤖 Pull Request Artifacts (#12505022131) 🎉

raise Exception(f'interface "{interface}" not found on device "{device_name}"')

@lru_cache
def get_device_ip_interfaces(device_name: str) -> Dict[str, List[str]]:
Copy link
Member

Choose a reason for hiding this comment

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

thought: Should we move this from this file to device/util.py instead? That will only keep the filters in this file. What do you think?

Comment on lines +59 to +62
FILTERS = {
"getenv": getenv,
"get_intf_ip": get_interface_ip,
}
Copy link
Member

Choose a reason for hiding this comment

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

question: Why do this? Why not keep it in filters.py?

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

Successfully merging this pull request may close these issues.

2 participants