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

NetBox Importer fails when using custom fields with type multiselect #174

Closed
lucagubler opened this issue Jun 8, 2024 · 0 comments · Fixed by #180
Closed

NetBox Importer fails when using custom fields with type multiselect #174

lucagubler opened this issue Jun 8, 2024 · 0 comments · Fixed by #180
Assignees
Labels
bug Something isn't working

Comments

@lucagubler
Copy link

Environment

  • Python version: 3.10.12
  • Nautobot version: 2.1.9
  • nautobot-netbox-importer version: 2.0.0
  • NetBox version: 3.6.3

Expected Behavior

Import custom fields with type multi-select into nautobot

Observed Behavior

The importer reports an InvalidChoiceValueIssue and replaces the type with text. All items using that custom field will later fail to be saved.

ImporterIssue(uid='790ec922-b539-56d7-8051-93a828acb98e', name='', issue_type='InvalidChoiceValueIssue', message="{'type': 'Invalid choice value: `multiobject`, replaced with `text`'}")
ImporterIssue(uid='50ec93c4-acd3-5378-82fa-90be9b9b1555', name='', issue_type='InvalidChoiceValueIssue', message="{'type': 'Invalid choice value: `object`, replaced with `text`'}")

Save failed: <class 'nautobot.extras.models.customfields.CustomField'> {'_state': <django.db.models.base.ModelState object at 0x7f74d1b4f9d0>, 'id': UUID('a061c722-4325-5501-bdb2-b0d9ffff1c8f'), 'created': None, 'last_updated': None, 'grouping': '', 'type': 'multi-select', 'label': 'Ansible Roles', 'key': 'ansible_roles', 'description': 'This field specifies the role(s) a host should have installed.', 'required': False, 'filter_logic': 'loose', 'default': ['sshd', 'vmware-tools', 'vim', 'locales', 'rsyslog', 'icinga1', 'snmpd', 'useful-tools', 'general'], 'weight': 100, 'validation_minimum': None, 'validation_maximum': None, 'validation_regex': '', 'advanced_ui': False}

Save failed: <class 'nautobot.virtualization.models.VirtualMachine'> {'_state': <django.db.models.base.ModelState object at 0x7f74cadc3b50>, 'id': UUID('7d618013-66ec-5c08-a409-739911b26a8c'), 'created': datetime.datetime(2024, 6, 7, 14, 6, 11, 548029, tzinfo=<UTC>), 'last_updated': datetime.datetime(2024, 6, 7, 14, 6, 11, 548067, tzinfo=<UTC>), '_custom_field_data': {'notes': None, 'ad_login': False, 'node_type': 'master', 'config_mode': None, 'environment': 'Testing', 'folder_name': 'ha-datacenter', 'last_update': '2023-06-01', 'tenant_fqdn': None, 'observium_id': None, 'update_group': None, 'ansible_roles': ['general', 'icinga1', 'locales', 'postfix', 'rsyslog', 'snmpd', 'sshd', 'useful_tools', 'vim', 'vmware_tools'], 'inform_tenant': False, 'onway_managed': True, 'appliance_type': 'onway_director', 'ansible_managed': False, 'platform_version': None, 'appliance_version': None, 'automation_groups': None, 'monitoring_icinga': False, 'additional_tenants': None, 'ignore_daily_check': True, 'monitoring_observium': False}, 'local_config_context_data': None, 'local_config_context_schema_id': None, 'local_config_context_data_owner_content_type_id': None, 'local_config_context_data_owner_object_id': None, 'cluster_id': None, 'tenant_id': UUID('9d803bec-81a6-53da-8374-1afb98808d6f'), 'platform_id': UUID('349d11d6-f51c-50bb-a321-2a2bf8f0e74a'), 'name': 'test.wlp.is', 'status_id': UUID('83aba25c-9874-4274-95d5-90df79615338'), 'role_id': UUID('72378ac1-4423-52e9-9dfe-9f4eedf504ad'), 'primary_ip4_id': UUID('5aec7675-a357-53f4-a651-2da4293b7cbe'), 'primary_ip6_id': None, 'vcpus': 4, 'memory': 8000, 'disk': 64, 'comments': ''}

Steps to Reproduce

  1. Create a custom field in netbox with type Multiple selection, e.g. ansible_roles.
  2. Add multiple items to that custom field using custom field choices, e.g. ["role_1", "role_2", "role_3"].
  3. Use this custom field on an item, e.g. create a new VM and add ansible roles.
  4. Try to use the netbox importer.
@cmsirbu cmsirbu added the bug Something isn't working label Jun 26, 2024
@gsnider2195 gsnider2195 self-assigned this Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants