Skip to content

'1 is not a valid choice' when adding interface  #191

@Joshi425

Description

@Joshi425

Describe the bug
when running netbox_agent -c netbox_agent.yml --register it breaks with:

INFO:root:Create new IP 172.19.0.3/24 on enp130s0f0
DEBUG:urllib3.connectionpool:https://netbox.host:443 "POST /api/ipam/ip-addresses/ HTTP/1.1" 400 39
Traceback (most recent call last):
  File "/usr/local/bin/netbox_agent", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/dist-packages/netbox_agent/cli.py", line 44, in main
    return run(config)
  File "/usr/local/lib/python3.6/dist-packages/netbox_agent/cli.py", line 39, in run
    server.netbox_create_or_update(config)
  File "/usr/local/lib/python3.6/dist-packages/netbox_agent/server.py", line 292, in netbox_create_or_update
    self.network.create_or_update_netbox_network_cards()
  File "/usr/local/lib/python3.6/dist-packages/netbox_agent/network.py", line 444, in create_or_update_netbox_network_cards
    self.create_or_update_netbox_ip_on_interface(ip, interface)
  File "/usr/local/lib/python3.6/dist-packages/netbox_agent/network.py", line 319, in create_or_update_netbox_ip_on_interface
    status=1,
  File "/usr/local/lib/python3.6/dist-packages/pynetbox/core/endpoint.py", line 283, in create
    ).post(args[0] if args else kwargs)
  File "/usr/local/lib/python3.6/dist-packages/pynetbox/core/query.py", line 383, in post
    return self._make_call(verb="post", data=data)
  File "/usr/local/lib/python3.6/dist-packages/pynetbox/core/query.py", line 274, in _make_call
    raise RequestError(req)
pynetbox.core.query.RequestError: The request failed with code 400 Bad Request: {'status': ['1 is not a valid choice.']}

Expected behavior
It should create the interface with the ip

Configuration file

# Netbox configuration
netbox:
 url: 'https://netbox.host'
 token: XXXX
network:
  ignore_interfaces: "(dummy.*|docker.*)"
  ignore_ips: (127\.0\.0\..*|.*:.*)
datacenter_location:
 driver: "cmd:cat /root/datacenter"
 regex: "(.*)"
inventory: true

Environment:

  • OS: Ubuntu 18.04.3
  • Netbox agent version v0.6.2
  • Netbox version v2.11.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions