bb-Ricardo / netbox-sync

Sync objects from VMware or redfish sources to NetBox
MIT License
290 stars 65 forks source link

FR: Synced tags from vCenter are pruned due to #359 #401

Open david-sieg opened 4 months ago

david-sieg commented 4 months ago

Hi Ricardo,

we switched from NetBox Sync 1.3.0 to 1.6.1 and surprisingly all our Tags on our VMs are reset to defaults.

Due to #359 tags are now pruned. Is there any switch to sync tags but keep existing tags in NetBox?

bb-Ricardo commented 2 months ago

Hi,

and sorry for the long wait.

I don't really understand your scenario. You have tags on a VM in NetBox which are not exiting in vcenter anymore and these get deleted?

Can you describe the issue a bit more detailed?

Thank you

david-sieg commented 2 months ago

Hi Ricardo,

we set tags to VMs in NetBox which aren't in vCenter. NetBox- sync overwrites existing tags in NetBox (from vCenter).

David

bb-Ricardo commented 2 months ago

Hi, If they are the same tag, then this is possible, yes

fiskn commented 1 week ago

I think I may have observed a bug relating to this behaviour as well. It seems the sync will mark a unused tag for deletion at the start of the sync, even if this tag is then assigned a bit later in the process to a VM the tag is still deleted at the end, resulting in a missing tag.

Steps to reproduce:

  1. Sync a VM with a tag that only exists on a single VM
  2. Remove tag in Netbox from VM manually
  3. Run another sync
  4. The sync process detects tag is missing from the VM and reassigns it, as seen in the logs
  5. At the end of the log "Deleting unused tag" is seen, which deletes the tag, thus removing it from the VM.

If I run the sync again, it then see's the tag is missing and then recreates it and assigns it to the VM again

bb-Ricardo commented 2 days ago

Hi,

Thank you for this description. Yes, this is indeed the case and needs to be fixed. This should be an easy one.