netbox-sync icon indicating copy to clipboard operation
netbox-sync copied to clipboard

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

Open david-sieg opened this issue 1 year ago • 3 comments

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?

david-sieg avatar Jul 08 '24 10:07 david-sieg

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

bb-Ricardo avatar Sep 13 '24 22:09 bb-Ricardo

Hi Ricardo,

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

David

david-sieg avatar Sep 16 '24 06:09 david-sieg

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

bb-Ricardo avatar Sep 16 '24 13:09 bb-Ricardo

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

fiskn avatar Nov 07 '24 10:11 fiskn

Hi,

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

bb-Ricardo avatar Nov 17 '24 08:11 bb-Ricardo

Hi @fiskn,

I adde a check for your described issue and pushed a new commit to the development branch. would you be able to check it out?

thank you

bb-Ricardo avatar Nov 20 '24 21:11 bb-Ricardo

Hi @david-sieg,

I still don't really get the issue.

tags which are set in NetBox and not used in vCenter are just ignored by the script. Just tested it again (in case of regressions).

would you be able to describe the setup more precisely so I can test it myself?

thank you

bb-Ricardo avatar Nov 20 '24 21:11 bb-Ricardo

Hi Ricardo,

I will test it again on wednesday, I'll give feedback.

David

david-sieg avatar Nov 25 '24 10:11 david-sieg

Hey, did you have a chance to test it?

bb-Ricardo avatar Feb 19 '25 22:02 bb-Ricardo

Hi Ricardo,

sorry for late answer and yes, tags won‘t be removed if not present in vcenter.

David

david-sieg avatar Feb 21 '25 19:02 david-sieg