Project

General

Profile

Actions

Bug #2968

closed

db encryption task fails

Added by Ohad Levy over 10 years ago. Updated over 9 years ago.

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

Description

RAILS_ENV=production bundle exec rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
==  ChangeComputeResourcePasswordToText: migrating ============================
-- change_column(:compute_resources, :password, :text)
   -> 0.1143s
-- You need to run rake security:generate_encryption_key to generate an ENCRYPTION_KEY.
-- Then, you may run rake db:compute_resources:encrypt to encrypt the passwords for Compute Resources.
-- Conversely, you may run rake db:compute_resources:decrypt to decrypt the passwords for Compute Resources.
==  ChangeComputeResourcePasswordToText: migrated (0.1145s) ===================

then

bundle exec rake security:generate_encryption_key
Encryption key generated in file config/initializers/encryption_key.rb
Restart the server and then run rake db:compute_resources:encrypt

and

 bundle exec rake db:compute_resources:encrypt --trace
** Invoke db:compute_resources:encrypt (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:compute_resources:encrypt
rake aborted!
undefined method `encryptable_fields' for #<Foreman::Model::Vmware:0x7f2293398868>
/home/foreman/git/foreman/vendor/bundle/ruby/1.8/gems/activemodel-3.2.14/lib/active_model/attribute_methods.rb:407:in `method_missing'
/home/foreman/git/foreman/vendor/bundle/ruby/1.8/gems/activerecord-3.2.14/lib/active_record/attribute_methods.rb:149:in `method_missing'
/home/foreman/git/foreman/lib/tasks/encrypt.rake:32
/home/foreman/git/foreman/vendor/bundle/ruby/1.8/gems/activerecord-3.2.14/lib/active_record/relation/delegation.rb:6:in `each'
/home/foreman/git/foreman/vendor/bundle/ruby/1.8/gems/activerecord-3.2.14/lib/active_record/relation/delegation.rb:6:in `__send__'
/home/foreman/git/foreman/vendor/bundle/ruby/1.8/gems/activerecord-3.2.14/lib/active_record/relation/delegation.rb:6:in `each'
/home/foreman/git/foreman/lib/tasks/encrypt.rake:31
/home/foreman/git/foreman/vendor/bundle/ruby/1.8/gems/rake-10.1.0/lib/rake/task.rb:236:in `call'
/home/foreman/git/foreman/vendor/bundle/ruby/1.8/gems/rake-10.1.0/lib/rake/task.rb:236:in `execute'
/home/foreman/git/foreman/vendor/bundle/ruby/1.8/gems/rake-10.1.0/lib/rake/task.rb:231:in `each'
/home/foreman/git/foreman/vendor/bundle/ruby/1.8/gems/rake-10.1.0/lib/rake/task.rb:231:in `execute'
/home/foreman/git/foreman/vendor/bundle/ruby/1.8/gems/rake-10.1.0/lib/rake/task.rb:175:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/home/foreman/git/foreman/vendor/bundle/ruby/1.8/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
/home/foreman/git/foreman/vendor/bundle/ruby/1.8/gems/rake-10.1.0/lib/rake/task.rb:161:in `invoke'
/home/foreman/git/foreman/vendor/bundle/ruby/1.8/gems/rake-10.1.0/lib/rake/application.rb:149:in `invoke_task'
/home/foreman/git/foreman/vendor/bundle/ruby/1.8/gems/rake-10.1.0/lib/rake/application.rb:106:in `top_level'
/home/foreman/git/foreman/vendor/bundle/ruby/1.8/gems/rake-10.1.0/lib/rake/application.rb:106:in `each'
/home/foreman/git/foreman/vendor/bundle/ruby/1.8/gems/rake-10.1.0/lib/rake/application.rb:106:in `top_level'
/home/foreman/git/foreman/vendor/bundle/ruby/1.8/gems/rake-10.1.0/lib/rake/application.rb:115:in `run_with_threads'
/home/foreman/git/foreman/vendor/bundle/ruby/1.8/gems/rake-10.1.0/lib/rake/application.rb:100:in `top_level'
/home/foreman/git/foreman/vendor/bundle/ruby/1.8/gems/rake-10.1.0/lib/rake/application.rb:78:in `run'
/home/foreman/git/foreman/vendor/bundle/ruby/1.8/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/home/foreman/git/foreman/vendor/bundle/ruby/1.8/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
/home/foreman/git/foreman/vendor/bundle/ruby/1.8/gems/rake-10.1.0/bin/rake:33
/home/foreman/git/foreman/vendor/bundle/ruby/1.8/bin/rake:19:in `load'
/home/foreman/git/foreman/vendor/bundle/ruby/1.8/bin/rake:19
Tasks: TOP => db:compute_resources:encrypt
[foreman@fdev foreman]$ 
Actions #1

Updated by Joseph Magen over 10 years ago

Ohad, I can't duplicate this issue. For some reason the mixin include Encryptable on ComputeResource is not working as self.encryptable_fields = :password is assigned by encrypts :password in the mixin

Actions #2

Updated by Dominic Cleal over 10 years ago

All of my testing has been under 1.9 or 2.0 and I noticed Ohad's using 1.8. I just tried launching a console under 1.8 and despite having config/initializers/encryption_key.rb, it isn't picked up:

$ rails c
For some operations a user must be set, try User.current = User.first
Loading development environment (Rails 3.2.14)
1.8.7 :001 > c = ComputeResource.first
ENCRYPTION_KEY is not defined, so encryption is turned off for ComputeResource.

Maybe this is the same issue?

Actions #3

Updated by Lukas Zapletal over 10 years ago

  • Target version changed from 1.3.0 to 1.4.0

Marking not to be picked into 1.3. Change if you don't share my opinion :-)

Actions #4

Updated by Greg Sutcliffe over 10 years ago

  • Target version deleted (1.4.0)
Actions #5

Updated by Ohad Levy over 9 years ago

  • Status changed from New to Closed

closing, as we are dropping 1.87 support for 1.7.

Actions

Also available in: Atom PDF