GithubHelp home page GithubHelp logo

migration-scripts's People

Contributors

jeremystretch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

migration-scripts's Issues

"contact_phone" and "contact_email" not migrated

It seems the Tabelle "contact_phone" and "contact_email" will not be migrated.

I'am neither a phyton nor an SQL programmer, but both below listed statements return a not empty list after running the migration script in NOT dry-run mode.

select * from dcim_site where contact_email != '';
select * from dcim_site where contact_phone != '';

Not able to run script

We are having an issue with running these scripts:
Running Netbox version 3.1.11-ldap-1.6.1 in docker

(venv) bash-5.1$ python3 manage.py runscript --loglevel debug --data '{"asn_rir": 2, "clear_site_field": false}' netbox_v32_migration.MigrateSiteASNsScript
🧬 loaded config '/etc/netbox/config/configuration.py'
🧬 loaded config '/etc/netbox/config/extra.py'
🧬 loaded config '/etc/netbox/config/logging.py'
🧬 loaded config '/etc/netbox/config/plugins.py'

[2022-08-25 09:27:08,332][INFO] - Running script (commit=False)
[2022-08-25 09:27:08,334][INFO] - Found 2 sites with a legacy ASN defined.
[2022-08-25 09:27:08,336][INFO] - Creating new ASN: 16509
[2022-08-25 09:27:08,337][ERROR] - An exception occurred: `ValueError: Cannot assign "2": "ASN.rir" must be a "RIR" instance.`
---
Traceback (most recent call last):
  File "/opt/netbox/netbox/extras/management/commands/runscript.py", line 44, in _run_script
    script.output = script.run(data=data, commit=commit)
  File "/etc/netbox/scripts/netbox_v32_migration.py", line 150, in run
    asn = ASN(asn=site.asn, rir=data['asn_rir'])
  File "/opt/netbox/venv/lib/python3.9/site-packages/django/db/models/base.py", line 485, in __init__
    _setattr(self, field.name, rel_obj)
  File "/opt/netbox/venv/lib/python3.9/site-packages/django/db/models/fields/related_descriptors.py", line 215, in __set__
    raise ValueError(
ValueError: Cannot assign "2": "ASN.rir" must be a "RIR" instance.

---
[2022-08-25 09:27:08,337][INFO] - Database changes have been reverted due to error.
[2022-08-25 09:27:08,337][ERROR] - Exception raised during script execution: Cannot assign "2": "ASN.rir" must be a "RIR" instance.
[2022-08-25 09:27:08,340][INFO] - Script completed in 0 minutes, 0.01 seconds

Also seeing the same issue with the contact migration script

(venv) bash-5.1$ python3 manage.py runscript --loglevel debug --data '{"contact_role": 1, "contact_priority": "primary", "clear_site_fields": false}' netbox_v32_migration.MigrateSiteContactsScript
🧬 loaded config '/etc/netbox/config/configuration.py'
🧬 loaded config '/etc/netbox/config/extra.py'
🧬 loaded config '/etc/netbox/config/logging.py'
🧬 loaded config '/etc/netbox/config/plugins.py'
[2022-08-25 09:31:59,190][INFO] - Running script (commit=False)
[2022-08-25 09:31:59,193][INFO] - Found 9 sites with legacy contact information defined.
[2022-08-25 09:31:59,195][INFO] - Creating new contact: John Smith
[2022-08-25 09:31:59,292][INFO] - Assigning contact John Smith to site Johns House
[2022-08-25 09:31:59,294][ERROR] - An exception occurred: `ValueError: Cannot assign "1": "ContactAssignment.role" must be a "ContactRole" instance.`
---
Traceback (most recent call last):
  File "/opt/netbox/netbox/extras/management/commands/runscript.py", line 44, in _run_script
    script.output = script.run(data=data, commit=commit)
  File "/etc/netbox/scripts/netbox_v32_migration.py", line 87, in run
    assignment = ContactAssignment(
  File "/opt/netbox/venv/lib/python3.9/site-packages/django/db/models/base.py", line 485, in __init__
    _setattr(self, field.name, rel_obj)
  File "/opt/netbox/venv/lib/python3.9/site-packages/django/db/models/fields/related_descriptors.py", line 215, in __set__
    raise ValueError(
ValueError: Cannot assign "1": "ContactAssignment.role" must be a "ContactRole" instance.

---
[2022-08-25 09:31:59,294][INFO] - Database changes have been reverted due to error.
[2022-08-25 09:31:59,294][ERROR] - Exception raised during script execution: Cannot assign "1": "ContactAssignment.role" must be a "ContactRole" instance.
[2022-08-25 09:31:59,298][INFO] - Script completed in 0 minutes, 0.11 seconds

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.