Jump to content

Update cleaner tool to remove all assets using their name

Recommended Posts


I've changed the way that we're registering a particular software asset because (as seems to be the new normal) we have ONE license key with a set amount of tokens which can be used against that license.

So, for instance, we have a software license for 600 users. I've now created a 'Master' asset which holds the license key, and 600 'token' assets which, when used, will be assigned to a user and then linked to the Master asset so that we can keep track of how many licenses we are actually using. This way, if the Master license key changes, we only need to change ONE asset, instead of 600! 

Unfortunately, the OLD way of doing this (where I just had 600 license assets all linked to the user who used this license) has meant that I now have 600 assets that I need to delete, but I can't because they're all linked to a user and an SR. 

So, my question is, could the Hornbill Cleaner tool be updated so that I can enter the h_name field from the h_cmdb_assets table and that will delete all assets with that name please?



Link to comment
Share on other sites

Hi @Paul Alexander,

We've just released v1.12.0 of the cleaner tool, which allows you to add more complex filters to filter the assets for deletion by.

So for example, if you wanted to delete all assets that have a name of YourAssetName, you would apply the following filter in the new AssetFilters array:

	"CleanRequests": false,
	"CleanAssets": true,
	"AssetClassID": "",
	"AssetTypeID": 0,
	"AssetFilters": [
			"ColumnName": "h_name",
			"ColumnValue": "YourAssetName",
			"Operator": "Equals",
			"IsGeneralProperty": true

The way the filters work (including available operators) is all documented on the Hornbill wiki.

Re: the 100 link limit, I'm not sure about that so I'll get someone who knows that area of the app a little better to respond.



  • Thanks 1
Link to comment
Share on other sites

@Paul Alexander Forgot to mention, as with any of the open source tools, and especially those that are destructive, it's highly recommended that you run your new config through this in dryrun mode first and check the logs to make sure the output is going to be as expected!



Link to comment
Share on other sites

Hi @ArmandoDM

There IS already a link between these assets - so yes, the error message is genuine (it was just a coincidence that it's happened when I added item no. 100)

Is there a way of, when I try to add a new link, to NOT have items which are already linked come up in the search results please? I've now got a point where if I do a search (in this case for anything named Nitro Token), all of the results which come up are already linked so I'm going to have to go through each individual item and link them separately....500 times! :D

Link to comment
Share on other sites

ONE more question though...

when I'm searching for assets to link, I can select up to 10 of the same 'name' at a time (so, for instance, I've searched for 'Nitro Token' 10 times and selected 10 items to link)



At this point, if I search for 'Nitro Token' again, I get a blank response.

However, if I search for ANYTHING else, I get a list of more items that I can select from: (here I've searched for 'server' for instance)



Is there a way of increasing the amount of hits I can do per search please? I'm having to do these 10 at a time, and then refresh the page (otherwise I get the error results mentioned earlier in this thread).



Link to comment
Share on other sites

@Paul Alexander

I think there is some caching logic that prevents you from loading more assets with the same name after loading the first 10.
I will report the issue you mentioned for review.
Apologies for the inconvenience.
Have you tried searching for 'Token' ? It should return 10 more results




Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...