Error expiring reports

Hi,

I had a daily cron job to expire foreman reports:

cd /usr/local/foreman
rake reports:expire days=1 status=0 RAILS_ENV="production"

This used to work fine.

I've now updated to use foreman from RPM so I changed the cron script to
do this:

cd /usr/share/foreman
rake reports:expire days=1 status=0 RAILS_ENV="production"

I now get this error:

Mysql::Error: Table 'puppet.messages' doesn't exist: SELECT messages.*
FROM messages INNER JOIN logs ON messages.id = logs.message_id
WHERE ((logs.report_id = 650919))

Do I need to change something?

R.

Hi Robin,

the messages table is created by
./db/migrate/20101018120548_create_messages.rb.

Please check if the table exists in your database and if the table
schema_migrations contains a version greater than '20101018120548'.

If the messages table doesn't exist in your database, you'll need to
run rake db:migrate RAILS_ENV=production to bring it to the latest
version.

Regards,
Jochen

··· On Sat, 27 Nov 2010 19:41:34 +0000, Robin Bowes wrote: > Hi, > > I had a daily cron job to expire foreman reports: > > cd /usr/local/foreman > rake reports:expire days=1 status=0 RAILS_ENV="production" > > This used to work fine. > > I've now updated to use foreman from RPM so I changed the cron script > to > do this: > > cd /usr/share/foreman > rake reports:expire days=1 status=0 RAILS_ENV="production" > > I now get this error: > > Mysql::Error: Table 'puppet.messages' doesn't exist: SELECT > `messages`.* > FROM `messages` INNER JOIN `logs` ON `messages`.id = > `logs`.message_id > WHERE ((`logs`.report_id = 650919)) > > Do I need to change something? > > R.

Another option is that because you switched from tar/git to rpm, you might
actually have two databases.

double check your /etc/foreman/database.yml ~foreman/config/database.yml etc
ensure that everything points to the same db as your original db in
/var/rails/foerman/config.

in anycase, you would need to do the migration manually when switching to
rpm, future migrations would be handled via the rpm itself (we cant migrate
your old db as during the rpm installation we didn't know where it was…)

Ohad

··· On Sun, Nov 28, 2010 at 7:27 AM, Jochen Schalanda wrote:

Hi Robin,

the messages table is created by
./db/migrate/20101018120548_create_messages.rb.

Please check if the table exists in your database and if the table
schema_migrations contains a version greater than ‘20101018120548’.

If the messages table doesn’t exist in your database, you’ll need to run
rake db:migrate RAILS_ENV=production to bring it to the latest version.

Regards,
Jochen

On Sat, 27 Nov 2010 19:41:34 +0000, Robin Bowes robin.bowes@yo61.com > wrote:

Hi,

I had a daily cron job to expire foreman reports:

cd /usr/local/foreman
rake reports:expire days=1 status=0 RAILS_ENV=“production”

This used to work fine.

I’ve now updated to use foreman from RPM so I changed the cron script to
do this:

cd /usr/share/foreman
rake reports:expire days=1 status=0 RAILS_ENV=“production”

I now get this error:

Mysql::Error: Table ‘puppet.messages’ doesn’t exist: SELECT messages.*
FROM messages INNER JOIN logs ON messages.id = logs.message_id
WHERE ((logs.report_id = 650919))

Do I need to change something?

R.


You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To post to this group, send email to foreman-users@googlegroups.com.
To unsubscribe from this group, send email to
foreman-users+unsubscribe@googlegroups.comforeman-users%2Bunsubscribe@googlegroups.com
.
For more options, visit this group at
http://groups.google.com/group/foreman-users?hl=en.

Thanks guys - it all worked fine after running the migrate task.

Thanks,

R.