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

Fix a nasty bug when calling abstracted class from_dict with V4 & V6 subclass #282

Conversation

ExaneServerTeam
Copy link
Contributor

@ExaneServerTeam ExaneServerTeam commented Apr 30, 2021

Issue

When calling objects.NetworkContainer.from_dict(args) the _custom_field_processing functions are not called.

For example, you get a list of dict for options instead of list of Dhcpoption objects

This applies to all Objects that are subclass with V4 and V6.

Root Cause

from_dict NetworkContainer class methodis from InfobloxObject from_dict classmethod

This parent class method from_dict is using the NetworkContainer class attributes (And there is none)

We definitely need to look up the V4 or V6 subclass first to get the class & attributes right

Issue:
    When calling objects.NetworkContainer.from_dict(args)
    the _custom_field_processing functions are not called
    For example you get a list of dict for options instead of
    list of Dhcpoption objects

    This applies for all Objects that are subclass with V4 and V6

Root Cause:
    from_dict NetworkContainer class methodis from InfobloxObject from_dict
    classmethod
    This parent class method from_dict is using the NetworkContainer class
    attibutes (And there is none)
    We definitly need to lookup the V4 or V6 subclass first to get
    the class & attributes right
@ExaneServerTeam ExaneServerTeam changed the title Fix a nasty bug when calling abstracted class with V4 & V6 subclass Fix a nasty bug when calling abstracted class from_dict with V4 & V6 subclass Apr 30, 2021
@codecov
Copy link

codecov bot commented Apr 30, 2021

Codecov Report

Merging #282 (df40b15) into master (e490922) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #282   +/-   ##
=======================================
  Coverage   90.94%   90.94%           
=======================================
  Files           7        7           
  Lines        4253     4254    +1     
  Branches      218      218           
=======================================
+ Hits         3868     3869    +1     
  Misses        333      333           
  Partials       52       52           
Impacted Files Coverage Δ
infoblox_client/objects.py 91.81% <100.00%> (+<0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e490922...df40b15. Read the comment docs.

@ExaneServerTeam
Copy link
Contributor Author

@AvRajath: Hello could you have a look at this PR ?

@AvRajath
Copy link
Contributor

AvRajath commented May 5, 2021

@somashekhar @anagha-infoblox can someone verify? This LGTM.

@somashekhar
Copy link
Contributor

LGTM

@somashekhar somashekhar merged commit 2c9dd6a into infobloxopen:master May 7, 2021
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.

3 participants