[rt-users] Issue when deleting Assets and recreating with roles

Alex Vandiver alexmv at bestpractical.com
Thu Oct 16 14:56:56 EDT 2014


On 10/16/2014 02:43 PM, fleon wrote:
> I experienced a bug with the Asset extension. When you find assets by name,
> when you press the bulk update button and change one value, the name of the
> search gets assigned to all assets.

Please explain more clearly what you mean by "the name of the search".
We do like to have good bug reports on issues like this.

> Having found this, i wanted to delete all assets and reinsert them. So i
> changed their status to deleted and tried again but got an error with the
> asset import csv extension.

Please give the error.

> So then i did a very foolish thing, and went over mysql and deleted the
> assets i wanted from the RTxAssets table.

Doing things like that puts you solidly in "good luck" territory, and
vastly decreases our ability or impetus to help you.  I strongly suggest
you copy over a new snapshot of production onto your development server
and start there -- assuming, of course, that this was in development and
you weren't running random DELETE statements on your production server,
riiiiight?

> When i want to import them again, i now get all kinds of errors regarding
> roles:
> 
> [30097] [Thu Oct 16 18:33:17 2014] [error]: Couldn't create role groups for
> asset 14504 (/opt/rt4/local/plugins/RT-Extension-Assets/lib/RT/Asset.pm:275)
> [30097] [Thu Oct 16 18:33:17 2014] [error]: Failed to create asset for row
> 303: Couldn't create role groups for asset
> (/opt/rt4/local/plugins/RT-Extension-Assets-Import-CSV/lib/RT/Extension/Assets/Import/CSV.pm:224)
> [30460] [Thu Oct 16 18:36:53 2014] [error]: Couldn't create a role group of
> type 'Owner' for RT::Asset 18517: Role group exists already
> (/opt/rt4/lib/RT/Record/Role/Roles.pm:588)
> 
> So i guess that means i need to delete those roles manually as well, but i
> haven't been able to find the table for that. Can someone give me a hint?

Assuming you deleted assets 1, 2, and 3:

DELETE FROM Groups
 WHERE Domain = 'RT::Asset-Role'
   AND Instance IN (1, 2, 3);

DELETE FROM ObjectCustomFieldValues
 WHERE ObjectType = 'RT::Asset'
   AND ObjectId IN (1, 2, 3);

DELETE FROM Transactions
 WHERE ObjectType = 'RT::Asset'
   AND ObjectId IN (1, 2, 3);

...there may well be others, those are the minimums that occur to me of
the top of my head.  I suggest you heed the earlier advice and start afresh.
 - Alex



More information about the rt-users mailing list