Remove/delete a category from many resources
Hi all,
I created a PropertySource a while back that sets a specific category on a bunch of devices but I've tweaked it since then to use two separate (more specific) categories on the devices instead of one (generic) one.
Problem is now I still have the original category set on all these devices and I'd like to do some cleanup to prevent confusion.
I know removing a category can be done via API and I've started looking into this but... Seems to be overly convoluted for this simple task.
So I think my question is: Is there a way to remove a category using a PropertySource? Since you can add categories via PropertySources, it'd be logical that you can remove them as well but I didn't find a way to do this.
LM User
Yeah, i see what you mean. I just wish it were consistent. If a PS sets a property then the PS later doesn't set the property it gets removed.
marting
OPI think there is a good reason for categories to not get deleted "automatically".
Scenario:
In this case, you wouldn't want the categories set by the PS to disappear, as that could affect your monitoring/alerting/etc. So I see why it doesn't automatically remove them when a PS doesn't set them. But it'd be nice to have an easier way to do cleanup... Guess I'll have to do the deep-dive into the API (which I need to do at some point anyway)...
LM User
Yes, you'd have to use the API to set the location property.
Bummer about system.categories. That may have been why i started shying away from categories as a way of tagging devices. It's overloaded.
Mike Moniz
I did a quick test and the normal auto properties it created does get removed, but categories don't change. If you change the category value it just adds the value as a new category with the old one. Removing the category from the script output completely it doesn't change at all. Yeah, seems system.categories is special.
P.S. I also verified that you are still not able to set the "location" property this way, it just creates an "auto.location" property.
LM User
I may be misunderstanding the issue (or thinking of regular properties, system.categories not being a regular property), but if the propertysource doesn't specify it anymore, it should remove it. Again, that may be a symptom of system.categories not being a 'normal' property.
Mike Moniz
I'm not aware of a way to do that myself. The API is likely your best bet. I would be worth submitting a feedback to LM to suggest the option to remove a category (seems useful to me too!).