Skip to content

[202405] Fix testbed_vm_info.py for ansible >= 2.14 (#20766)#21291

Merged
wangxin merged 1 commit intosonic-net:202405from
wangxin:202405-cp-20766
Nov 19, 2025
Merged

[202405] Fix testbed_vm_info.py for ansible >= 2.14 (#20766)#21291
wangxin merged 1 commit intosonic-net:202405from
wangxin:202405-cp-20766

Conversation

@wangxin
Copy link
Copy Markdown
Collaborator

@wangxin wangxin commented Nov 11, 2025

Cherry pick #20766 to 202405 branch

After ansible >= 2.14, custom modules are executed on the managed node (or in an execution environment container) that only contains the runtime bits Ansible intentionally ships there (mainly ansible.module_utils plus Python stdlib). Controller‑only internals like ansible.inventory.manager and ansible.parsing.dataloader are not present. So importing them on the remote side is fundamentally unsupported now.

This change removed the code of importing ansible API in the testbed_vm_info.py customized module. Then this module can be executed in sonic-mgmt docker using ansible >= 2.14.


Description of PR

Summary:
Fixes # (issue)

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • New Test case
    • Skipped for non-supported platforms
  • Test case improvement

Back port request

  • 202205
  • 202305
  • 202311
  • 202405
  • 202411
  • 202505

Approach

What is the motivation for this PR?

How did you do it?

How did you verify/test it?

Any platform specific information?

Supported testbed topology if it's a new test case?

Documentation

* Fix testbed_vm_info.py for ansible >= 2.14

After ansible >= 2.14, custom modules are executed on the managed node (or in an execution environment container) that only contains the runtime bits Ansible intentionally ships there (mainly ansible.module_utils plus Python stdlib). Controller‑only internals like ansible.inventory.manager and ansible.parsing.dataloader are not present. So importing them on the remote side is fundamentally unsupported now.

This change removed the code of importing ansible API in the testbed_vm_info.py customized module. Then this module can be executed in sonic-mgmt docker using ansible >= 2.14.

Signed-off-by: Xin Wang <xiwang5@microsoft.com>

* Fix pre-commit issue and add back hashbang

---------

Signed-off-by: Xin Wang <xiwang5@microsoft.com>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@wangxin
Copy link
Copy Markdown
Collaborator Author

wangxin commented Nov 19, 2025

#18044 not in 202405, import snappi_convergence failed while collecting test cases. Need to force merge.

@wangxin wangxin merged commit 60bb665 into sonic-net:202405 Nov 19, 2025
3 of 6 checks passed
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