Bug #56

Error when adding audit table if puppet storeconfig tables exist

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

Status:Closed Start:10/27/2009
Priority:Normal Due date:
Assigned to:Ohad Levy % Done:

100%

Category:Database
Target version:0.1-2
Backlog: Difficulity:
Votes: 0

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.

foreman_rails_error - rake db migrate error (13.3 KB) Matt Delves, 10/30/2009 03:57 am

Associated revisions

Revision 38a51fc29825625e09ebb9ed4bdb84afcdfe65da
Added by Ohad Levy over 2 years ago

fixes #56, changed the migration order

History

Updated by Matt Delves over 2 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)

Updated by Ohad Levy over 2 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

Updated by Matt Delves over 2 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`

Updated by Ohad Levy over 2 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

Updated by Ohad Levy over 2 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

Updated by Matt Delves over 2 years ago

commenting out the acts_as_audited line does fix the problem.

Updated by Ohad Levy over 2 years ago

  • Category set to Database
  • Status changed from New to Assigned
  • Assigned to 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.

Updated by Ohad Levy over 2 years ago

  • Status changed from Assigned to Need more information
  • Assigned to 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

Updated by Matt Delves over 2 years ago

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

Thanks,
Matt

Updated by Ohad Levy over 2 years ago

  • Assigned to changed from Matt Delves to Ohad Levy

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

Updated by Ohad Levy over 2 years ago

  • Status changed from Need more information to Assigned

Updated by Ohad Levy over 2 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

Updated by Ohad Levy over 2 years ago

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

Updated by Ohad Levy over 2 years ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF