IPAddress DHCP status is not migrated #3229

Closed
opened 2025-12-29 18:26:54 +01:00 by adam · 9 comments
Owner

Originally created by @shuichiro-makigaki on GitHub (Jan 28, 2020).

Originally assigned to: @jeremystretch on GitHub.

Environment

  • Python version: 3.7
  • NetBox version: 2.7.2

Steps to Reproduce

  1. Upgrade from v2.6.3
  2. Execute migration
  3. Show IPAddress whose status is "DHCP"

Expected Behavior

Show the IP correctly

Observed Behavior

  • The status column/row shows nothing (actually, shows string "5" as Invisible Man)
  • IPAddress resource API returns an error: Key Not Found: '5'
Originally created by @shuichiro-makigaki on GitHub (Jan 28, 2020). Originally assigned to: @jeremystretch on GitHub. <!-- NOTE: This form is only for reproducible bugs. If you need assistance with NetBox installation, or if you have a general question, DO NOT open an issue. Instead, post to our mailing list: https://groups.google.com/forum/#!forum/netbox-discuss Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report. --> ### Environment * Python version: 3.7<!-- Example: 3.5.4 --> * NetBox version: 2.7.2<!-- Example: 2.5.2 --> <!-- Describe in detail the exact steps that someone else can take to reproduce this bug using the current stable release of NetBox (or the current beta release where applicable). Begin with the creation of any necessary database objects and call out every operation being performed explicitly. If reporting a bug in the REST API, be sure to reconstruct the raw HTTP request(s) being made: Don't rely on a wrapper like pynetbox. --> ### Steps to Reproduce 1. Upgrade from v2.6.3 2. Execute migration 2. Show IPAddress whose status is "DHCP" <!-- What did you expect to happen? --> ### Expected Behavior Show the IP correctly <!-- What happened instead? --> ### Observed Behavior * The status column/row shows nothing (actually, shows string "5" as Invisible Man) * IPAddress resource API returns an error: `Key Not Found: '5'`
adam added the type: bugstatus: accepted labels 2025-12-29 18:26:54 +01:00
adam closed this issue 2025-12-29 18:26:54 +01:00
Author
Owner

@DanSheps commented on GitHub (Jan 28, 2020):

Thank you for your interest in NetBox. GitHub issues are intended for reporting reproducible bugs and requesting features, and must be submitted using one of the templates provided here. For general discussion, questions, or assistance with installation issues, please post to our mailing list instead.

@DanSheps commented on GitHub (Jan 28, 2020): Thank you for your interest in NetBox. GitHub issues are intended for reporting reproducible bugs and requesting features, and must be submitted using one of the templates provided [here](https://github.com/digitalocean/netbox/issues/new/choose). For general discussion, questions, or assistance with installation issues, please post to our [mailing list](https://groups.google.com/forum/#!forum/netbox-discuss) instead.
Author
Owner

@DanSheps commented on GitHub (Jan 28, 2020):

To be clear, I have attempted to reproduce this at https://master.netbox.dansheps.com and I am unable to.

Please provide exact steps to reproduce if you wish for us to revisit this, however this seems like it may be a missing step in a upgrade rather then a bug at first glance.

@DanSheps commented on GitHub (Jan 28, 2020): To be clear, I have attempted to reproduce this at https://master.netbox.dansheps.com and I am unable to. Please provide exact steps to reproduce if you wish for us to revisit this, however this seems like it may be a missing step in a upgrade rather then a bug at first glance.
Author
Owner

@shuichiro-makigaki commented on GitHub (Jan 28, 2020):

@DanSheps
Thank you for your quick response. I added some reproducing procedures.

It seems that ba8f324 does not migrate the status "DHCP" to slug.

@shuichiro-makigaki commented on GitHub (Jan 28, 2020): @DanSheps Thank you for your quick response. I added some reproducing procedures. It seems that ba8f324 does not migrate the status "DHCP" to slug.
Author
Owner

@DanSheps commented on GitHub (Jan 28, 2020):

Alright, this helps now, I will have to go back to 2.6.x and test this out

@DanSheps commented on GitHub (Jan 28, 2020): Alright, this helps now, I will have to go back to 2.6.x and test this out
Author
Owner

@DanSheps commented on GitHub (Jan 28, 2020):

Just as a quick update, the migration code is in there, so unless something else is happening it should migrate.

Are you fully migrated (can you try running the migrations again?)

@DanSheps commented on GitHub (Jan 28, 2020): Just as a quick update, the migration code is in there, so unless something else is happening it should migrate. Are you fully migrated (can you try running the migrations again?)
Author
Owner

@shuichiro-makigaki commented on GitHub (Jan 28, 2020):

Are you fully migrated

Yes. By running manage.py migrate.

https://github.com/netbox-community/netbox/blob/master/netbox/ipam/migrations/0029_3569_ipaddress_fields.py#L4

IPADDRESS_STATUS_CHOICES should contain (5, 'dhcp'), I think.
The 0029 migration updates IPAddress status to slug, except for DHCP.

@shuichiro-makigaki commented on GitHub (Jan 28, 2020): > Are you fully migrated Yes. By running `manage.py migrate`. https://github.com/netbox-community/netbox/blob/master/netbox/ipam/migrations/0029_3569_ipaddress_fields.py#L4 `IPADDRESS_STATUS_CHOICES` should contain `(5, 'dhcp')`, I think. The `0029` migration updates IPAddress status to slug, except for DHCP.
Author
Owner

@shuichiro-makigaki commented on GitHub (Jan 28, 2020):

(can you try running the migrations again?)

It is hard to rerun the migration. I have already created a new migration patch and applied it.
(2897232af5_
As a result, this problem is solved by the patch.

@shuichiro-makigaki commented on GitHub (Jan 28, 2020): > (can you try running the migrations again?) It is hard to rerun the migration. I have already created a new migration patch and applied it. (https://github.com/shuichiro-makigaki/netbox/commit/2897232af5c7cf24b50f1a5be4f1d7ba0866ba1d_ As a result, this problem is solved by the patch.
Author
Owner

@candlerb commented on GitHub (Jan 28, 2020):

FYI: I see the same problem. In a system migrated from 2.6 to 2.7:

netbox=# select status,count(*) from ipam_ipaddress group by status;
   status   | count
------------+-------
 5          |   134
 deprecated |    18
 active     |  1230
 reserved   |    28
(4 rows)

I hadn't noticed until now - thanks for detecting this.

In the GUI, status displays as a white 5 on a white background, which is invisible. When you hover over it, the background changes to grey so it is visible (just).

@candlerb commented on GitHub (Jan 28, 2020): FYI: I see the same problem. In a system migrated from 2.6 to 2.7: ``` netbox=# select status,count(*) from ipam_ipaddress group by status; status | count ------------+------- 5 | 134 deprecated | 18 active | 1230 reserved | 28 (4 rows) ``` I hadn't noticed until now - thanks for detecting this. In the GUI, status displays as a white 5 on a white background, which is invisible. When you hover over it, the background changes to grey so it is visible (just).
Author
Owner

@jeremystretch commented on GitHub (Jan 28, 2020):

The PR above will fix this, but if you'd rather not wait for the next release, you can do this to apply the fix immediately:

### NetBox interactive shell (jstretch-workstation)
### Python 3.6.9 | Django 2.2.9 | NetBox 2.7.3-dev
### lsmodels() will show available models. Use help(<model>) for more info.
>>> IPAddress.objects.filter(status='5').update(status='dhcp')
0

(The number returned at the end indicates the number of IP addresses updated.)

@jeremystretch commented on GitHub (Jan 28, 2020): The PR above will fix this, but if you'd rather not wait for the next release, you can do this to apply the fix immediately: ```$ ./manage.py nbshell ### NetBox interactive shell (jstretch-workstation) ### Python 3.6.9 | Django 2.2.9 | NetBox 2.7.3-dev ### lsmodels() will show available models. Use help(<model>) for more info. >>> IPAddress.objects.filter(status='5').update(status='dhcp') 0 ``` (The number returned at the end indicates the number of IP addresses updated.)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3229