datacenter / acitoolkit

A basic toolkit for accessing the Cisco APIC
Other
350 stars 266 forks source link

_interface_from_dn usage seems broken in Python3.6 #356

Open sjbanner opened 4 years ago

sjbanner commented 4 years ago

I am not certain if this is an issue with my system or a more general issue, but I was recently converting some programs I have that use acitoolkit from python2.7 to python3.6. Mostly the conversion has been trivial, but I found that "session.get_deep()" was crashing as were calls to "Interface.get(session, linecard)", both at aciphysobject.py, line 3021:

                interface_obj = ACI._interface_from_dn(dist_name)

The following change fixed the problem:

                interface_obj = ACI.acitoolkit._interface_from_dn(dist_name)

The only place the acitoolkit._interface_from_dn() method appears to be used is in the get() method of the Interface class, so it appears to be a safe change, but I have not got the time to test it properly, and there may be a better way to fix this (it looks like it should have been imported, so why does it in Python2.7, but not Python3.6?).

edwin053 commented 5 months ago

@jcarre59 - just ran across same issue - fix does appear to be trivial and in that single location. Did you find out otherwise post your changes? I'm using some other pieces as well - and I would be happy to log a PR - just don't want to:

  1. claim credit (for someone else's work)
  2. redo (ultimately not the solution) work.
sjbanner commented 2 months ago

I never had the chance to properly validate beyond my original post. Go ahead and log a PR.