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

Device display error after deleting its primary IP address #137

Open
matthieup opened this issue Apr 7, 2021 · 0 comments
Open

Device display error after deleting its primary IP address #137

matthieup opened this issue Apr 7, 2021 · 0 comments

Comments

@matthieup
Copy link

Environment

  • Python version: 3.8.8
  • NetBox version: 2.10.8
  • ntc-netbox-plugin-onboarding version: 2.1.0 ( both pip, and built from master and develop )
    Also this was tested under docker via image netboxcommunity/netbox:v2.10.8-ldap.

Steps to Reproduce

  1. Create device Test_01
  2. Create test-interface and binding to to Test_01
  3. Create IPaddress 1.1.1.1/24 and binding to test-interface
  4. Set primary IP of Test_01 to 1.1.1.1/24
  5. Delete IPaddress 1.1.1.1/24
  6. View Device Test_01 and it'll get an error of IPaddressDoesNotExist

Confirmed also that this only happens when having netbox_onboarding plugin enabled in netbox.
This was also reported on netbox-community/netbox#6069 before we found out this is only happening when netbox_onboarding is enabled.

Expected Behavior

After removing primary IP address of device, the device details should show up correctly without a restart of netbox.

Observed Behavior

Gettting an exception <class 'ipam.models.IPAddress.DoesNotExist'> as can be seen in the attached pictures.

Restarting Netbox fixes the problem, so it seems it may be related to a cache issue

Tested fix

As a quick fix, I tried to catch the exception by:

        try:
            ip = self.device.primary_ip4
        except IPAddress.DoesNotExist:
            return "unknown"

in functions last_check_attempt_date(self), last_check_successful_date(self), status(self) and last_ot(self) and device was able to be displayed correctly.

snapshot-ipv4-1
snapshot-ipv4-2

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

No branches or pull requests

1 participant