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

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

Open
Joshi425 opened this issue Aug 18, 2021 · 4 comments
Open

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

Joshi425 opened this issue Aug 18, 2021 · 4 comments

Comments

@Joshi425
Copy link

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
@KivraChristoffer
Copy link
Contributor

KivraChristoffer commented Sep 2, 2021

We found there is a switch in how it stores status, so by changing from ' status=1' to 'status="active", we got past that problem

@sylr
Copy link
Contributor

sylr commented Aug 8, 2022

Can confirm.

@orlov88
Copy link

orlov88 commented Sep 19, 2022

I have the "active" status
query_params = { 'address': ip, 'status': "active", 'assigned_object_type': self.assigned_object_type, 'assigned_object_id': interface.id }

@orlov88
Copy link

orlov88 commented Sep 19, 2022

if there is no ipmi on the server, I can collect the information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants