Skip to content

IPAddress DHCP status is not migrated #4027

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

Closed
shuichiro-makigaki opened this issue Jan 28, 2020 · 9 comments · Fixed by #4032
Closed

IPAddress DHCP status is not migrated #4027

shuichiro-makigaki opened this issue Jan 28, 2020 · 9 comments · Fixed by #4032
Assignees
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@shuichiro-makigaki
Copy link
Contributor

shuichiro-makigaki commented Jan 28, 2020

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'
@DanSheps
Copy link
Member

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
Copy link
Member

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.

shuichiro-makigaki added a commit to shuichiro-makigaki/netbox that referenced this issue Jan 28, 2020
ba8f324 does not migrate the status "DHCP" to slug.
@shuichiro-makigaki
Copy link
Contributor Author

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

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

@DanSheps
Copy link
Member

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

@DanSheps DanSheps reopened this Jan 28, 2020
@DanSheps
Copy link
Member

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?)

@shuichiro-makigaki
Copy link
Contributor Author

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
Copy link
Contributor Author

(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.
(shuichiro-makigaki@2897232_
As a result, this problem is solved by the patch.

@candlerb
Copy link
Contributor

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).

@jeremystretch jeremystretch self-assigned this Jan 28, 2020
@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application labels Jan 28, 2020
jeremystretch added a commit that referenced this issue Jan 28, 2020
@jeremystretch
Copy link
Member

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 added a commit that referenced this issue Jan 28, 2020
Fixes #4027: Repair schema migration for IP addresses with DHCP status
This was referenced Jan 28, 2020
@lock lock bot locked as resolved and limited conversation to collaborators May 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants