You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating a front port, the order of the 'device' and 'rear_port' parameters is significant, though most of us expect dictionaries to be unordered collections.
If the 'rear_port' parameter is specified before the 'device', the call to _find_ids() in netbox_utils.py fails because the device ID hasn't been looked up and added to 'data' before the call to look up the rear port. This means that at the time of the call to find the rear port, the device_id is still the name of the device, resulting in the error message: "device_id: test100 is not a valid value."
The only solutions I have found are either to document the issue or to sort the parameters. Sorting the parameters works in this case since 'device' comes before 'rear_port' when sorted.
We could change line 1197 in netbox_utils.py from: for k, v in data.items():
to: for k, v in sorted(data.items()):
However, neither solution is satisfying. Does anyone have a better solution?
Regards
Per
Working tasks:
- name: "REAR_PORT: Necessary info creation"
netbox.netbox.netbox_rear_port:
netbox_url: http://localhost:32768
netbox_token: "0123456789abcdef0123456789abcdef01234567"
data:
device: test100
name: Rear Port 2
type: bnc
state: present
- name: "FRONT_PORT: Necessary info creation"
netbox.netbox.netbox_front_port:
netbox_url: http://localhost:32768
netbox_token: "0123456789abcdef0123456789abcdef01234567"
data:
device: test100
name: Front Port
type: bnc
rear_port: Rear Port 2
state: present
Failing tasks:
- name: "REAR_PORT: Necessary info creation"
netbox.netbox.netbox_rear_port:
netbox_url: http://localhost:32768
netbox_token: "0123456789abcdef0123456789abcdef01234567"
data:
device: test100
name: Rear Port 2
type: bnc
state: present
- name: "FRONT_PORT: Necessary info creation"
netbox.netbox.netbox_front_port:
netbox_url: http://localhost:32768
netbox_token: "0123456789abcdef0123456789abcdef01234567"
data:
name: Front Port
type: bnc
rear_port: Rear Port 2
device: test100
state: present
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
When creating a front port, the order of the 'device' and 'rear_port' parameters is significant, though most of us expect dictionaries to be unordered collections.
If the 'rear_port' parameter is specified before the 'device', the call to _find_ids() in netbox_utils.py fails because the device ID hasn't been looked up and added to 'data' before the call to look up the rear port. This means that at the time of the call to find the rear port, the device_id is still the name of the device, resulting in the error message: "device_id: test100 is not a valid value."
The only solutions I have found are either to document the issue or to sort the parameters. Sorting the parameters works in this case since 'device' comes before 'rear_port' when sorted.
We could change line 1197 in netbox_utils.py from:
for k, v in data.items():
to:
for k, v in sorted(data.items()):
However, neither solution is satisfying. Does anyone have a better solution?
Regards
Per
Working tasks:
Failing tasks:
Beta Was this translation helpful? Give feedback.
All reactions