Project

General

Profile

Bug #56

Error when adding audit table if puppet storeconfig tables exist

Added by Matt Delves almost 10 years ago. Updated almost 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Database
Target version:
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Team Backlog:
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.

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

Associated revisions

Revision 38a51fc2 (diff)
Added by Ohad Levy almost 10 years ago

fixes #56, changed the migration order

History

#1 Updated by Matt Delves almost 10 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)

#2 Updated by Ohad Levy almost 10 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

#3 Updated by Matt Delves almost 10 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`

#4 Updated by Ohad Levy almost 10 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

#5 Updated by Ohad Levy almost 10 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

#6 Updated by Matt Delves almost 10 years ago

commenting out the acts_as_audited line does fix the problem.

#7 Updated by Ohad Levy almost 10 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.

#8 Updated by Ohad Levy almost 10 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

#9 Updated by Matt Delves almost 10 years ago

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

Thanks,
Matt

#10 Updated by Ohad Levy almost 10 years ago

  • Assignee changed from Matt Delves to Ohad Levy

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

#11 Updated by Ohad Levy almost 10 years ago

  • Status changed from Need more information to Assigned

#12 Updated by Ohad Levy almost 10 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

#13 Updated by Ohad Levy almost 10 years ago

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

#14 Updated by Ohad Levy almost 10 years ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF