Scope Ansible connection vars per host#23298
Draft
bingwang-ms wants to merge 3 commits intosonic-net:masterfrom
Draft
Scope Ansible connection vars per host#23298bingwang-ms wants to merge 3 commits intosonic-net:masterfrom
bingwang-ms wants to merge 3 commits intosonic-net:masterfrom
Conversation
Co-authored-by: Copilot <[email protected]> Signed-off-by: Bing Wang (SONIC) <[email protected]>
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Co-authored-by: Copilot <[email protected]> Signed-off-by: Bing Wang (SONIC) <[email protected]>
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Co-authored-by: Copilot <[email protected]> Signed-off-by: Bing Wang (SONIC) <[email protected]>
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
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.
Description of PR
Summary:
Prevent host-specific Ansible connection and credential overrides from leaking through shared variable-manager state and affecting later DUT operations in mixed topologies.
Fixes # N/A
Type of change
Back port request
Approach
What is the motivation for this PR?
Mixed fanout environments can exercise different device wrappers in the same run. Some wrappers were storing host-specific values such as
ansible_connection, credentials, and become settings in sharedvariable_manager.extra_vars. That allowed one host's connection mode, for examplenetwork_cli, to leak into later DUT operations and caused commands such asduthost.command()andduthost.shell()to run with the wrong connection context.How did you do it?
Added host-scoped variable helpers in
AnsibleHostBaseand updated the affected device wrappers to set connection and authentication overrides on the target inventory host instead of writing them into shared extra vars.How did you verify/test it?
Ran:
python -m py_compile tests/common/devices/base.py tests/common/devices/sonic.py tests/common/devices/aos.py tests/common/devices/arista.py tests/common/devices/cisco.py tests/common/devices/eos.py tests/common/devices/juniper.py tests/common/devices/k8s.py tests/common/devices/onyx.pyAny platform specific information?
No platform-specific behavior is intended. The fix is framework-side and applies to mixed topologies where multiple host wrappers are used in the same run.
Supported testbed topology if it's a new test case?
N/A
Documentation
No documentation update is required for this framework fix.