FR: Synced tags from vCenter are pruned due to #359
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?
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
Hi Ricardo,
we set tags to VMs in NetBox which aren't in vCenter. NetBox- sync overwrites existing tags in NetBox (from vCenter).
David
Hi, If they are the same tag, then this is possible, yes
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:
- Sync a VM with a tag that only exists on a single VM
- Remove tag in Netbox from VM manually
- Run another sync
- The sync process detects tag is missing from the VM and reassigns it, as seen in the logs
- 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
Hi,
Thank you for this description. Yes, this is indeed the case and needs to be fixed. This should be an easy one.
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
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
Hi Ricardo,
I will test it again on wednesday, I'll give feedback.
David
Hey, did you have a chance to test it?
Hi Ricardo,
sorry for late answer and yes, tags won‘t be removed if not present in vcenter.
David