-
Notifications
You must be signed in to change notification settings - Fork 201
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
Fix(eos_validate_state): Update error message when a device does not have httpapi _sub_plugin #4049
Conversation
Review docs on Read the Docs To test this pull request: # Create virtual environment for this testing below the current directory
python -m venv test-avd-pr-4049
# Activate the virtual environment
source test-avd-pr-4049/bin/activate
# Install all requirements including PyAVD
pip install "pyavd[ansible] @ git+https://github.com/MaheshGSLAB/ansible-avd.git@issue-3882#subdirectory=python-avd" --force
# Install Ansible collection
ansible-galaxy collection install git+https://github.com/MaheshGSLAB/ansible-avd.git#/ansible_collections/arista/avd/,issue-3882 --force
# Optional: Install AVD examples
cd test-avd-pr-4049
ansible-playbook arista.avd.install_examples |
...e_collections/arista/avd/plugins/plugin_utils/eos_validate_state_utils/ansible_eos_device.py
Outdated
Show resolved
Hide resolved
else: | ||
raise AristaAvdError(message=f"The provided Ansible connection does not use EOS HttpApi plugin: {plugin_name}") | ||
except AttributeError as err: | ||
raise AristaAvdError(message="AVD could not determine ansible connection. Please configure ansible_connection as `httpapi` for this host.") from err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raise AristaAvdError(message="AVD could not determine ansible connection. Please configure ansible_connection as `httpapi` for this host.") from err | |
raise AristaAvdError(message="AVD could not determine the Ansible connection plugin used. Please ensure that the 'ansible_network_os' and 'ansible_connection' variables are set to 'eos' and 'httpapi' respectively for this host.") from err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
If ansible_network_os is not defined and ansible_connection defined as httpapi then we face below error
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'Connection' object has no attribute 'nonetype'
fatal: [leaf2-dc1]: FAILED! => {"msg": "Unexpected failure during module execution: 'Connection' object has no attribute 'nonetype'", "stdout": ""}
and this is from netcommon collection
File "/home/maheshkumar/Projecct/ansible-avd/ansible_collections/ansible/netcommon/plugins/plugin_utils/connection_base.py", line 50, in __getattr__
raise AttributeError(
AttributeError: 'Connection' object has no attribute 'nonetype'
fatal: [leaf2-dc1]: FAILED! => {
"msg": "Unexpected failure during module execution: 'Connection' object has no attribute 'nonetype'",
"stdout": ""
}
cc: @gmuloc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets make all this nice maybe outside of the try except
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Co-authored-by: Carl Baillargeon <[email protected]>
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Quality Gate passedIssues Measures |
Change Summary
Better error message needed when a device does not have httpapi _sub_plugin
Related Issue(s)
Fixes #3882
Component(s) name
arista.avd.eos_validate_state
Proposed changes
Added the If condition to check _sub_plugin is there or not.
How to test
To reproduce issue we have to comment out ansible_connection vars.
Checklist
User Checklist
Repository Checklist