Bug #56
closedError when adding audit table if puppet storeconfig tables exist
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
Updated by Matt Delves about 15 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 about 15 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 about 15 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 about 15 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 about 15 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 about 15 years ago
commenting out the acts_as_audited line does fix the problem.
Updated by Ohad Levy about 15 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.
Updated by Ohad Levy about 15 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
Updated by Matt Delves about 15 years ago
- File foreman_rails_error foreman_rails_error added
Attached is the output I ran from 'rake db:migrate RAILS_ENV=production'.
Thanks,
Matt
Updated by Ohad Levy about 15 years ago
- Assignee changed from Matt Delves to Ohad Levy
I'll try again with MySQL, I've only tried sqlite database.
Updated by Ohad Levy about 15 years ago
- Status changed from Need more information to Assigned
Updated by Ohad Levy about 15 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 about 15 years ago
- Status changed from Assigned to Ready For Testing
- % Done changed from 0 to 100
Applied in changeset 38a51fc29825625e09ebb9ed4bdb84afcdfe65da.
Updated by Ohad Levy about 15 years ago
- Status changed from Ready For Testing to Closed