Skip to content

Conversation

@michaelarnauts
Copy link
Contributor

@michaelarnauts michaelarnauts commented Oct 27, 2022

When syncing between netbox and netshot, we already need to pass the netshot_domain_id. Newly added devices are added in that domain.

However, when fetching the list in netshot, so we know what devices to disable, we don't use that domain_id, so we will disable all devices instead of just the ones we are trying to sync.

I have a usecase with two groups of devices in netbox, that have a different device role (customers, backbone). Each role goes into it's own domain in netshot. The current code will disable all devices from the customer domain, when I sync the backbone domain and visa versa.

Example commands to sync both groups:

$ netbox2netshot --netbox-url http://x.x.x.x --netbox-token xxx --netbox-devices-filter "status=active&role=cpe" --netshot-url https://y.y.y.y --netshot-token yyy --netshot-domain-id 1
$ netbox2netshot --netbox-url http://x.x.x.x --netbox-token xxx --netbox-devices-filter "status=active&role=backbone" --netshot-url https://y.y.y.y --netshot-token yyy --netshot-domain-id 2

This MR fixes this, by fetching only the devices that we are actually trying to sync.

As a small bonus, I fixed two typo's.

@kedare
Copy link
Contributor

kedare commented Nov 9, 2022

Hello Michael.

Great, thank you for your PR, indeed in my case I only had 1 domain so we did not face this issue, looks good for me (but I don't have a netshot instance anymore to test it), I will merge it and create a new release.

Thank you again. :)

Mathieu

@kedare kedare self-assigned this Nov 9, 2022
@kedare kedare self-requested a review November 9, 2022 17:14
@kedare kedare merged commit a6fb231 into scaleway:master Nov 9, 2022
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

Successfully merging this pull request may close these issues.

2 participants