Can't call method "HasRight"

Hi,

I’ve hit the following snag, with more info futher down.
If anyone has any ideas, I’d love to hear them!

‘Everyone’ has ‘CreateTicket’ rights.

First the error:
[root@rtdev1 log]# /apps/rt/bin/rt-mailgate --debug --queue
incidentreports --action correspond --url http://rtdev1.our.orgFrom: jblaine@our.org
Subject: testing mailgate
To: incident-reports@rtdev1.our.org

FOO
/apps/rt/bin/rt-mailgate: temp file is ‘/tmp/j8KbkElkcm’
/apps/rt/bin/rt-mailgate: connecting to
http://rtdev1.our.org/REST/1.0/NoAuth/mail-gateway
Can’t call method “HasRight” on an undefined value at
/apps/rt/bin/…/lib/RT/User_Overlay.pm line 1277.

Background and other info:

This is a development box with the goal of duplicating
the production box.

I dumped the majority of tables from the production box
and loaded them on this development box. I left out
’sessions’, ‘tickets’, ‘links’, ‘attachments’, ‘transactions’,
and ‘templates’

On this box, after the “migration”, Configuration --> Users
shows “root” and not the other ~40 users that the production
server shows. Looking in the public.users, they are present,
so I can’t figure that out…

So far, this is the only thing that appears flawed in
the “migration” – the website is up, I can see the
queues in the UI.

Hi,

I’ve hit the following snag, with more info futher down.
If anyone has any ideas, I’d love to hear them!

‘Everyone’ has ‘CreateTicket’ rights.

First the error:

[root@rtdev1 log]# /apps/rt/bin/rt-mailgate --debug --queue
incidentreports --action correspond --url http://rtdev1.our.org
From: jblaine@our.org
Subject: testing mailgate
To: incident-reports@rtdev1.our.org

FOO
/apps/rt/bin/rt-mailgate: temp file is ‘/tmp/j8KbkElkcm’
/apps/rt/bin/rt-mailgate: connecting to
http://rtdev1.our.org/REST/1.0/NoAuth/mail-gateway
Can’t call method “HasRight” on an undefined value at
/apps/rt/bin/…/lib/RT/User_Overlay.pm line 1277.

Without an RT version, that error message can’t be used to figure out
what happened.

I suspect you’ve broken some of your other tables in the migration if
memberships aren’t showing up properly

-kevin

Hi,

I’ve hit the following snag, with more info futher down.
If anyone has any ideas, I’d love to hear them!

‘Everyone’ has ‘CreateTicket’ rights.

First the error:

[root@rtdev1 log]# /apps/rt/bin/rt-mailgate --debug --queue
incidentreports --action correspond --url http://rtdev1.our.org
From: jblaine@our.org
Subject: testing mailgate
To: incident-reports@rtdev1.our.org

FOO
/apps/rt/bin/rt-mailgate: temp file is ‘/tmp/j8KbkElkcm’
/apps/rt/bin/rt-mailgate: connecting to
http://rtdev1.our.org/REST/1.0/NoAuth/mail-gateway
Can’t call method “HasRight” on an undefined value at
/apps/rt/bin/…/lib/RT/User_Overlay.pm line 1277.

Without an RT version, that error message can’t be used to figure out
what happened.

I suspect you’ve broken some of your other tables in the migration if
memberships aren’t showing up properly

-kevin

3.8.7 with the security patches

I suspect that as well, but it took me ~3 hours to
get this far and I’m trying to get past it somehow
instead of trying to figure out a completely different
plan of attack and starting over :frowning:

Can’t call method “HasRight” on an undefined value at
/apps/rt/bin/…/lib/RT/User_Overlay.pm line 1277.
Without an RT version, that error message can’t be used to figure out
what happened.
3.8.7 with the security patches

I suspect that as well, but it took me ~3 hours to
get this far and I’m trying to get past it somehow
instead of trying to figure out a completely different
plan of attack and starting over :frowning:

Looks like your Principals table and Users table are no longer in
sync. That’s bad.

-kevin

I suspect that as well, but it took me ~3 hours to
get this far and I’m trying to get past it somehow
instead of trying to figure out a completely different
plan of attack and starting over :frowning:

Did you drop the relevant fresh tables that you then loaded data into
after make initdb?

You don’t say how you loaded up the data, but if you ended up generating
new id sequences when you inserted rows into Principals and Users, you’d
surely create an unworkable database.

Try running rt-validator in check mode to see if it can make heads or
tails of your database.

These are all just guesses. We don’t have nearly enough information
here to do anything than that. Perhaps you want to start over by
copying the entire database and then using Shredder to get rid of
tickets, attachments, links, and transactions.

Thomas

I suspect that as well, but it took me ~3 hours to
get this far and I’m trying to get past it somehow
instead of trying to figure out a completely different
plan of attack and starting over :frowning:

I appreciate the replies, everyone. I’m far from a DB guy,
so there’s zero guarantee I’ve done anything right, but I
did what seemed to make sense to me. You can point and
laugh at me if you’d like :slight_smile: I realize this is pretty
out of scope for standard rt-users list fare.

Did you drop the relevant fresh tables that you then loaded data into
after make initdb?

No. I deleted the data from them.

DELETE FROM tablename WHERE id > 0;

I was afraid to drop the tables for fear that there was
some black magic interconnectedness that I’d screw up
and never be able to reproduce.

Perhaps I did just that by being fearful

I dumped the databases as such, on the production server:

for i in psql -U postgres rt3 -c "\dt" | grep table | awk '{print $3}' | sed -e '/transactions/D' -e '/tickets/D' -e '/sessions/D' -e '/attachments/D' -e '/links/D'
do
pg_dump --table $i -U postgres rt3 > DUMP.$i.sql
done

I copied these dump files over to the development server.

I edited each one and commented out the CREATE TABLE,
INDEX, and ALTER TABLE…ADD CONSTRAINT statements.

I loaded them on the development server with:

 psql -f filename rt3 postgres

Here is the non-verbose rt-validate summary.

The output is 23MB (!), 6MB if I strip out the stuff
about ‘Tickets’, which were not carried over from
the production server (on purpose).

Running rt-validate again with --check --resolve --force
cuts the output down to 15MB from 23MB. Still light
years from reasonable to figure out.

[root@rtdev1 src]# grep ‘in Groups references not existent record in
Tickets’ validation.log | wc -l
89660
[root@rtdev1 src]#

[root@rtdev1 src]# sed 's/(Record) #[0-9]* (in .*)/\1 \2/'
validation.log | grep Record | sort | uniq
Record in Attributes references not existent record in Tickets
Record in CachedGroupMembers references not existent record in GroupMembers
Record in CachedGroupMembers references not existent record in Groups
Record in ObjectCustomFieldValues references not existent record in Tickets
Record in Groups references not existent record in Tickets
[root@rtdev1 src]#

Some example full lines are at the end of the message,
though I think they’re mostly pointless to you.

You don’t say how you loaded up the data, but if you ended up generating
new id sequences when you inserted rows into Principals and Users, you’d
surely create an unworkable database.

Try running rt-validator in check mode to see if it can make heads or
tails of your database.

These are all just guesses. We don’t have nearly enough information
here to do anything than that. Perhaps you want to start over by
copying the entire database and then using Shredder to get rid of
tickets, attachments, links, and transactions.

Unfortunately, bringing the “DATA data” over is not an
option due to a security policy.

Suggested paths forward? Start over and drop the tables
before loading the data?

Record #25 in Groups references not existent record in Tickets
Instance => ‘1’ => id

Record #26 in Groups references not existent record in Tickets
Instance => ‘1’ => id

Record #350522 in CachedGroupMembers references not existent record in
GroupMembers
GroupId => ‘188231’ => GroupId
MemberId => ‘136849’ => MemberId

Record #350514 in CachedGroupMembers references not existent record in
GroupMembers
GroupId => ‘188234’ => GroupId
MemberId => ‘74’ => MemberId

Record #350490 in CachedGroupMembers references not existent record in
Groups
GroupId => ‘188222’ => id
MemberId => ‘188222’ => id

Record #350491 in CachedGroupMembers references not existent record in
Groups
GroupId => ‘188223’ => id
MemberId => ‘188223’ => id

Record #59 in Attributes references not existent record in Tickets
ObjectId => ‘3’ => id

Record #143 in Attributes references not existent record in Tickets
ObjectId => ‘5397’ => id

Record #1 in ObjectCustomFieldValues references not existent record in
Tickets
ObjectId => ‘1’ => id

Record #213126 in ObjectCustomFieldValues references not existent record
in Tickets
ObjectId => ‘1’ => id

I suspect that as well, but it took me ~3 hours to
get this far and I’m trying to get past it somehow
instead of trying to figure out a completely different
plan of attack and starting over :frowning:

I appreciate the replies, everyone. I’m far from a DB guy,
so there’s zero guarantee I’ve done anything right, but I
did what seemed to make sense to me. You can point and
laugh at me if you’d like :slight_smile: I realize this is pretty
out of scope for standard rt-users list fare.

Did you drop the relevant fresh tables that you then loaded data into
after make initdb?

No. I deleted the data from them.

What tables did you delete? You appear to have removed much more than
just ticket data. Not having principal, group, groupmember or
cachedgroupmembers data is going to cause failures.

As Tom mentioned earlier, you might be better served copying the data
and using shredder to remove the appropriate data.

-kevin

I suspect that as well, but it took me ~3 hours to
get this far and I’m trying to get past it somehow
instead of trying to figure out a completely different
plan of attack and starting over :frowning:

I appreciate the replies, everyone. I’m far from a DB guy,
so there’s zero guarantee I’ve done anything right, but I
did what seemed to make sense to me. You can point and
laugh at me if you’d like :slight_smile: I realize this is pretty
out of scope for standard rt-users list fare.

Did you drop the relevant fresh tables that you then loaded data into
after make initdb?

No. I deleted the data from them.

What tables did you delete? You appear to have removed much more than
just ticket data. Not having principal, group, groupmember or
cachedgroupmembers data is going to cause failures.

I deleted, on the new development server, only
tables I was importing from the production server.

I brought everything EXCEPT the sessions, attachments,
transactions, and tickets tables over from production
to development.

“”"
I copied these dump files over to the development server.

I edited each one and commented out the CREATE TABLE,
INDEX, and ALTER TABLE…ADD CONSTRAINT statements.

I loaded them on the development server with:

 psql -f filename rt3 postgres

“”"

I suspect that as well, but it took me ~3 hours to
get this far and I’m trying to get past it somehow
instead of trying to figure out a completely different
plan of attack and starting over :frowning:

I appreciate the replies, everyone. I’m far from a DB guy,
so there’s zero guarantee I’ve done anything right, but I
did what seemed to make sense to me. You can point and
laugh at me if you’d like :slight_smile: I realize this is pretty
out of scope for standard rt-users list fare.

Did you drop the relevant fresh tables that you then loaded data into
after make initdb?

No. I deleted the data from them.

What tables did you delete? You appear to have removed much more than
just ticket data. Not having principal, group, groupmember or
cachedgroupmembers data is going to cause failures.

I deleted, on the new development server, only
tables I was importing from the production server.

I brought everything EXCEPT the sessions, attachments,
transactions, and tickets tables over from production
to development.

“”"
I copied these dump files over to the development server.

I edited each one and commented out the CREATE TABLE,
INDEX, and ALTER TABLE…ADD CONSTRAINT statements.

I loaded them on the development server with:

psql -f filename rt3 postgres

“”"

Yes, I read this in your earlier email

However, you don’t appear to have valid principal group groupmember or
cachedgroupmember data, so I assume something went wrong in your
import.

-kevin

I suspect that as well, but it took me ~3 hours to
get this far and I’m trying to get past it somehow
instead of trying to figure out a completely different
plan of attack and starting over :frowning:

I appreciate the replies, everyone. I’m far from a DB guy,
so there’s zero guarantee I’ve done anything right, but I
did what seemed to make sense to me. You can point and
laugh at me if you’d like :slight_smile: I realize this is pretty
out of scope for standard rt-users list fare.

Did you drop the relevant fresh tables that you then loaded data into
after make initdb?

No. I deleted the data from them.

What tables did you delete? You appear to have removed much more than
just ticket data. Not having principal, group, groupmember or
cachedgroupmembers data is going to cause failures.

I deleted, on the new development server, only
tables I was importing from the production server.

I brought everything EXCEPT the sessions, attachments,
transactions, and tickets tables over from production
to development.

“”"
I copied these dump files over to the development server.

I edited each one and commented out the CREATE TABLE,
INDEX, and ALTER TABLE…ADD CONSTRAINT statements.

I loaded them on the development server with:

 psql -f filename rt3 postgres

“”"

Yes, I read this in your earlier email

However, you don’t appear to have valid principal group groupmember or
cachedgroupmember data, so I assume something went wrong in your
import.

Hmm, you’re right. I just imported principal and
cachedgroupmembers again – this time fully. Not
sure what went wrong, but I’ll go back and redo
group and groupmember as well, then run rt-validate
again.

Thanks!

Hmm, you’re right. I just imported principal and
cachedgroupmembers again – this time fully. Not
sure what went wrong, but I’ll go back and redo
group and groupmember as well, then run rt-validate
again.

Thanks!

Okay, now we’re getting somewhere! Zero validation
problems other than the expected “Ticket” ones.

Now the problem is that the sequence stuff is out
of whack I guess. Any ideas as to how I might I go
about fixing that? It really doesn’t matter to us
if the next generated sequence is "wastefully high"
to get us over this hurdle. Do you think I could
just set them (?) all to 60000 (production DB where
this data came from has 47000 tickets, so that is
surely the largest id)?

Sequence stuff out of whack:

Jul 12 23:02:37 rtdev1 RT: DBD::Pg::st execute failed: ERROR: duplicate
key violates unique constraint “principals_pkey” at
/usr/lib/perl5/site_perl/5.8.8/DBIx/SearchBuilder/Handle.pm line 509.
(/usr/lib/perl5/site_perl/5.8.8/DBIx/SearchBuilder/Handle.pm:509)
Jul 12 23:02:37 rtdev1 RT: RT::Handle=HASH(0x2b2602b19a70) couldn’t
execute the query ‘INSERT INTO Principals (ObjectId, Disabled,
PrincipalType) VALUES (?, ?, ?)’ at
/usr/lib/perl5/site_perl/5.8.8/DBIx/SearchBuilder/Handle.pm line 522
DBIx::SearchBuilder::Handle::SimpleQuery(‘RT::Handle=HASH(0x2b2602b19a70)’,
‘INSERT INTO Principals (ObjectId, Disabled, PrincipalType) VA…’, 0,
0, ‘Group’) called at
/usr/lib/perl5/site_perl/5.8.8/DBIx/SearchBuilder/Handle.pm line 357
DBIx::SearchBuilder::Handle::Insert(‘RT::Handle=HASH(0x2b2602b19a70)’,
‘Principals’, ‘ObjectId’, 0, ‘Disabled’, 0, ‘PrincipalType’, ‘Group’)
called at /usr/lib/perl5/site_perl/5.8.8/DBIx/SearchBuilder/Handle/Pg.pm
line 66
DBIx::SearchBuilder::Handle::Pg::Insert(‘RT::Handle=HASH(0x2b2602b19a70)’,
‘Principals’, ‘ObjectId’, 0, ‘PrincipalType’, ‘Group’, ‘Disabled’, 0)
called at /usr/lib/perl5/site_perl/5.8.8/DBIx/SearchBuilder/Record.pm
line 1293
DBIx::SearchBuilder::Record::Create(‘RT::Principal=HASH(0x2b2608435340)’, ‘ObjectId’,
0, ‘Disabled’,
Jul 12 23:02:37 rtdev1 RT: DBD::Pg::st execute failed: ERROR: currval
of sequence “groups_id_seq” is not yet defined in this session at
/usr/lib/perl5/site_perl/5.8.8/DBIx/SearchBuilder/Handle/Pg.pm line 78.
(/usr/lib/perl5/site_perl/5.8.8/DBIx/SearchBuilder/Handle/Pg.pm:78)
Jul 12 23:02:37 rtdev1 RT: DBD::Pg::st fetchrow_array failed: no
statement executing at
/usr/lib/perl5/site_perl/5.8.8/DBIx/SearchBuilder/Handle/Pg.pm line 79.
(/usr/lib/perl5/site_perl/5.8.8/DBIx/SearchBuilder/Handle/Pg.pm:79)
Jul 12 23:02:37 rtdev1 RT: Couldn’t create a ticket group of type
’Requestor’ for ticket 4: Could not create group
(/apps/rt/bin/…/lib/RT/Ticket_Overlay.pm:989)
Jul 12 23:02:37 rtdev1 RT: Couldn’t create ticket groups for ticket 4.
aborting Ticket creation. (/apps/rt/bin/…/lib/RT/Ticket_Overlay.pm:509)
Jul 12 23:02:37 rtdev1 RT: Ticket could not be created due to an
internal error (/apps/rt/bin/…/lib/RT/Interface/Email.pm:244)
Jul 12 23:02:37 rtdev1 RT: Could not record email: Ticket creation
failed: Ticket could not be created due to an internal error
(/apps/rt/share/html/REST/1.0/NoAuth/mail-gateway:75)

Hmm, you’re right. I just imported principal and
cachedgroupmembers again – this time fully. Not
sure what went wrong, but I’ll go back and redo
group and groupmember as well, then run rt-validate
again.

Thanks!

Okay, now we’re getting somewhere! Zero validation
problems other than the expected “Ticket” ones.

Now the problem is that the sequence stuff is out
of whack I guess. Any ideas as to how I might I go
about fixing that?

For now, this is all solved. Thanks so much for the
help.

I dove in and altered all of the sequences to reflect
the associated data. Restarted PostgreSQL and ticket
creation via email began working immediately.