tumblr / collins

groovy kind of love
tumblr.github.com/collins
Apache License 2.0
572 stars 99 forks source link

DynamicEnum values not being cleaned up #546

Open michaeljs1990 opened 7 years ago

michaeljs1990 commented 7 years ago

At some point in time AssetMeta.Enum was deprecated however the new AssetMeta.DynamicEnum which took it's place was never fully implemented (at least in my opinion). Currently when you update an asset all of the LSHW values and LLDP values in AssetMeta.Enum are remove from the asset and repopulated however if you add something to the new AssetMeta.DynamicEnum the value is added to the database however the initial value is not removed causing it to be returned instead. From the GUI this looks like the LSHW parser has a bug and is not populating the asset. It also has the undesired side effect of a ton of extra entries in the asset_meta_value db. When i found this bug on a node I had been playing with I had about 50 entries for GPUs which would be a super sweet machine but it only had 4 :(

I have a fix for this I'll post shortly and hope to get merged in :)

@byxorna @defect @roymarantz

michaeljs1990 commented 7 years ago

I should update this slightly... While we ran into this as being an issue when adding the GPU feature it is also an issue for

BASE_DESCRIPTION
BASE_PRODUCT
BASE_VENDOR
BASE_SERIAL

Which end up cropping up strangely in the UI with id's next to them. The nice thing about this fix is the first time a node is inducted again all previous values are cleared and only the new one will remain.