Callum027 / ipam-migrator

Data migration tool for between phpIPAM and NetBox
GNU General Public License v3.0
17 stars 8 forks source link

KeyError: ('vlan',) #7

Open joubbi opened 2 years ago

joubbi commented 2 years ago

I used the fork https://github.com/absynth47215/ipam-migrator Thank you @Callum027 and @absynth47215 for sharing your work!

When I run this command: $ ipam-migrator --log-level DEBUG -naisv https://localhost/api/netbox,phpipam,login,username,ipamadmin

It does it's thing for a while and then stops with this error:

2022-01-19 09:12:15,789 ipam-migrator: [INFO] Found 1420 prefixes.

2022-01-19 09:12:15,790 ipam-migrator: [INFO] Searching for IP addresses used in found prefixes...

2022-01-19 09:14:42,645 ipam-migrator: [DEBUG] found IP address 10.x.x.x with description 'Security loopback'

2022-01-19 09:14:42,647 ipam-migrator: [DEBUG] found IP address 10.x.x.x with description 'Security loopback'

2022-01-19 09:16:30,041 ipam-migrator: [INFO] Found 2 IP addresses.

2022-01-19 09:16:30,042 ipam-migrator: [INFO] Searching for VLANs...

2022-01-19 09:16:30,298 ipam-migrator: [ERROR] ('vlan',)

Traceback (most recent call last):

  File "/usr/local/lib/python3.9/dist-packages/ipam_migrator-1.0.0-py3.9.egg/ipam_migrator/ipam_migrator.py", line 172, in main

    input_database = input_backend.database_read()

  File "/usr/local/lib/python3.9/dist-packages/ipam_migrator-1.0.0-py3.9.egg/ipam_migrator/backend/phpipam.py", line 310, in database_read

    vlans = self.vlans_read() if read_vlans else None

  File "/usr/local/lib/python3.9/dist-packages/ipam_migrator-1.0.0-py3.9.egg/ipam_migrator/backend/phpipam.py", line 421, in vlans_read

    if "GET" in self.api_controller_methods("vlan")[("vlan",)]:

KeyError: ('vlan',)

2022-01-19 09:16:30,323 ipam-migrator: [DEBUG] stopping logger

Any ideas?

Absynth723 commented 2 years ago

I think this was a bug that I introduced when trying to make vlan export work again. I have committed a fix, maybe you can update your working tree and try again to see if it works.

joubbi commented 2 years ago

It works now! Thank you very much for such a quick fix!