Project

General

Profile

Actions

Bug #56

closed

Error when adding audit table if puppet storeconfig tables exist

Added by Matt Delves over 14 years ago. Updated over 14 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Database
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

If you run the command 'rake db:migrate RAILS_ENV=production' having configured the foreman database to be the same as the puppet database, it will error and not create the audits table.

Workaround:
1. Recreate the puppet database, though don't start puppetmasterd
2. run 'rake db:migrate RAILS_ENV=production'
3. start puppetmasterd.


Files

foreman_rails_error foreman_rails_error 13.3 KB rake db migrate error Matt Delves, 10/30/2009 03:57 AM
Actions #1

Updated by Matt Delves over 14 years ago

To reproduce:

1. Configure puppet to use storeconfigs.
2. Start puppetmasterd and have it create / populate the tables in the database.
3. Try to run 'rake db:migrate RAILS_ENV=production'

(should have added this when creating the bug report)

Actions #2

Updated by Ohad Levy over 14 years ago

Matt Delves wrote:

If you run the command 'rake db:migrate RAILS_ENV=production' having configured the foreman database to be the same as the puppet database, it will error and not create the audits table.

Workaround:
1. Recreate the puppet database, though don't start puppetmasterd
2. run 'rake db:migrate RAILS_ENV=production'
3. start puppetmasterd.

can you provide the error that you've got?

Thanks

Actions #3

Updated by Matt Delves over 14 years ago

The error I get is:

ChangeHostBuildDefaultToFale: migrating ==========
-- change_column(:hosts, :build, :boolean, {:default=>false})
-> 0.0166s
rake aborted!
An error has occurred, all later migrations canceled:

Mysql::Error: Table 'puppet.audits' doesn't exist: SHOW FIELDS FROM `audits`

Actions #4

Updated by Ohad Levy over 14 years ago

Matt Delves wrote:

The error I get is:

ChangeHostBuildDefaultToFale: migrating ==========
-- change_column(:hosts, :build, :boolean, {:default=>false})
-> 0.0166s
rake aborted!
An error has occurred, all later migrations canceled:

Mysql::Error: Table 'puppet.audits' doesn't exist: SHOW FIELDS FROM `audits`

does commenting line 16 in app/models/host.rb solves the problem?
(acts_as_audited...)
if it does, let me know and I'll submit the patch.

Thanks

Actions #5

Updated by Ohad Levy over 14 years ago

Ohad Levy wrote:

Matt Delves wrote:

The error I get is:

ChangeHostBuildDefaultToFale: migrating ==========
-- change_column(:hosts, :build, :boolean, {:default=>false})
-> 0.0166s
rake aborted!
An error has occurred, all later migrations canceled:

Mysql::Error: Table 'puppet.audits' doesn't exist: SHOW FIELDS FROM `audits`

does commenting line 16 in app/models/host.rb solves the problem?
(acts_as_audited...)
if it does, let me know and I'll submit the patch.

Thanks

if it does work, please run rake db:migrate --trace RAILS_ENV=production and submit the error - thanks

Actions #6

Updated by Matt Delves over 14 years ago

commenting out the acts_as_audited line does fix the problem.

Actions #7

Updated by Ohad Levy over 14 years ago

  • Category set to Database
  • Status changed from New to Assigned
  • Assignee set to Ohad Levy
  • Priority changed from Low to Normal
  • Target version set to 0.1-2

when initializing a new migration, Plugin db table has not been assigned yet, therefor it should be excluded in rake tasks or reordered.

Actions #8

Updated by Ohad Levy over 14 years ago

  • Status changed from Assigned to Need more information
  • Assignee changed from Ohad Levy to Matt Delves
  • Target version deleted (0.1-2)

I cant reproduce it.. what I've done:

enabled storeconfigs on a puppetmaster
run one host against it so it generated the storeconfigs database.

then I've configured config/database to point to the same database and I've run rake db:migrate.

everything seems to be working correctly.

could you reproduce your error? please provide the output with --trace

thanks

Actions #9

Updated by Matt Delves over 14 years ago

Attached is the output I ran from 'rake db:migrate RAILS_ENV=production'.

Thanks,
Matt

Actions #10

Updated by Ohad Levy over 14 years ago

  • Assignee changed from Matt Delves to Ohad Levy

I'll try again with MySQL, I've only tried sqlite database.

Actions #11

Updated by Ohad Levy over 14 years ago

  • Status changed from Need more information to Assigned
Actions #12

Updated by Ohad Levy over 14 years ago

  • Target version set to 0.1-2

ok, I can confirm this happens on MySQL.. I'll bump it to the current release

Actions #13

Updated by Ohad Levy over 14 years ago

  • Status changed from Assigned to Ready For Testing
  • % Done changed from 0 to 100
Actions #14

Updated by Ohad Levy over 14 years ago

  • Status changed from Ready For Testing to Closed
Actions

Also available in: Atom PDF