Remove salt grains

We had a bunch of salt grains uploaded to foreman inadvertently. In many cases, it means that there are duplicates (like fqdn).

Is there a way to remove those grains without affecting the existing puppet facts?

I don’t use Salt so I’m not sure of the specifics, but most likely you can do this by running something similar to this in the foreman console:

ForemanSalt::FactName.destroy_all

Interesting - I’d give that a try, but I’ve already done this by going directly into the database and deleting the fact_values rows that were associated to fact_names with type=ForemanSalt::Factname.

You can still run that to clean up the leftover fact names (which may impact the import speed if there are many of them).