-
Notifications
You must be signed in to change notification settings - Fork 171
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
Interface description values such as 5j evaluated as complex, cast to string #1017
Interface description values such as 5j evaluated as complex, cast to string #1017
Conversation
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 3m 29s |
Additional successful manual testing done against the 2960X to set interface descriptions:
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1017 +/- ##
=======================================
Coverage 86.93% 86.93%
=======================================
Files 195 195
Lines 12102 12102
=======================================
Hits 10521 10521
Misses 1581 1581 |
for more information, see https://pre-commit.ci
@gellis713 Thank you for the contribution, I have pushed some additional changes considering your solution. |
for more information, see https://pre-commit.ci
SUMMARY
Fixes #829
#829 details a scenario where interface descriptions such as:
5j
05j
1j
25j
125j
19J
82J
causes the Python JSON encoder to throw an error stating "Object of type complex is not JSON serializable". After some digging this complex data type is being returned from the Template class in Ansible Netcommon Utils
The call function renders the data into "value" and tries to use ast to perform an evaluation of a literal structure. Most literal_evals will throw an error (such as
ValueError: malformed node or string on line 1: <ast.Name object at 0x7f1302b682b0>
which is caught and the value is casted into a string. Since "5j" and variants are actually evaluated into complex data type, it just gets passed back as is.ISSUE TYPE
COMPONENT NAME
cisco_ios.ios.ios_interfaces Module
ADDITIONAL INFORMATION
Tested on Cisco 2960X, Version 15.0(2)EX4
After change (5j value that previously evaluated to complex):
After change (typical description format):