Foreman failing for db::migrate for puppet 3.0 with the following error :rake aborted! uninitialized constant HostObserver

600 views
Skip to first unread message

Nishant Jain

unread,
Oct 18, 2012, 2:20:24 PM10/18/12
to puppet...@googlegroups.com
Hello Everybody,
                          I am trying to configure foreman for puppet 3.0. on centos 6.3
                          I have followed the instructions provided over here to install foreman:-
                          I have installed the following rpm:

                                 I have done the settings for the files in /etc/foreman as follows:-

                                 settings.yaml has the following contents:
                                 :puppet_server: puppet
                         :unattended: true
                         :puppetconfdir: /etc/puppet/puppet.conf
                         :login: false
                         :require_ssl: false

                         database.yaml has the following contents:
                         # SQLite version 3.x
#   gem install sqlite3
development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: sqlite3
  database: db/test.sqlite3
  pool: 5
  timeout: 5000

#production:
#  adapter: sqlite3
#  database: db/production.sqlite3
#  pool: 5
#  timeout: 5000


production:
  adapter: mysql
  database: puppetdb
  username: puppetdb
  password: puppetdb
  host: 10.12.14.107
  socket: "/var/run/mysqld/mysqld.sock"


            I am getting the following error when am trying to execute db:migrate command: 
            su - foreman -s /bin/bash -c /usr/share/foreman/extras/dbmigrate

                It fails with the following error:
                /usr/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:10: warning: already initialized constant ENC_NONE
/usr/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:11: warning: already initialized constant ENC_EUC
/usr/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:12: warning: already initialized constant ENC_SJIS
/usr/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:13: warning: already initialized constant ENC_UTF8
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
uninitialized constant HostObserver



         When i tried to run it with trace option I get the following output:
/usr/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:10: warning: already initialized constant ENC_NONE
/usr/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:11: warning: already initialized constant ENC_EUC
/usr/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:12: warning: already initialized constant ENC_SJIS
/usr/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:13: warning: already initialized constant ENC_UTF8
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
uninitialized constant HostObserver
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/ext/module.rb:36:in `const_missing'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.15/lib/active_support/inflector/methods.rb:113:in `constantize'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.15/lib/active_support/inflector/methods.rb:112:in `each'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.15/lib/active_support/inflector/methods.rb:112:in `constantize'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.15/lib/active_support/core_ext/string/inflections.rb:43:in `constantize'
/usr/lib/ruby/gems/1.8/gems/activemodel-3.0.15/lib/active_model/observing.rb:66:in `instantiate_observer'
/usr/lib/ruby/gems/1.8/gems/activemodel-3.0.15/lib/active_model/observing.rb:39:in `instantiate_observers'
/usr/lib/ruby/gems/1.8/gems/activemodel-3.0.15/lib/active_model/observing.rb:39:in `each'
/usr/lib/ruby/gems/1.8/gems/activemodel-3.0.15/lib/active_model/observing.rb:39:in `instantiate_observers'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.15/lib/active_record/railtie.rb:83
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.15/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.15/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.15/lib/active_support/lazy_load_hooks.rb:26:in `on_load'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.15/lib/active_record/railtie.rb:82
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.15/lib/active_support/lazy_load_hooks.rb:34:in `call'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.15/lib/active_support/lazy_load_hooks.rb:34:in `execute_hook'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.15/lib/active_support/lazy_load_hooks.rb:43:in `run_load_hooks'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.15/lib/active_support/lazy_load_hooks.rb:42:in `each'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.15/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.15/lib/rails/application/finisher.rb:46
/usr/lib/ruby/gems/1.8/gems/railties-3.0.15/lib/rails/initializable.rb:25:in `instance_exec'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.15/lib/rails/initializable.rb:25:in `run'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.15/lib/rails/initializable.rb:50:in `run_initializers'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.15/lib/rails/initializable.rb:49:in `each'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.15/lib/rails/initializable.rb:49:in `run_initializers'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.15/lib/rails/application.rb:134:in `initialize!'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.15/lib/rails/application.rb:77:in `send'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.15/lib/rails/application.rb:77:in `method_missing'
/usr/share/foreman/config/environment.rb:5
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.15/lib/active_support/dependencies.rb:242:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.15/lib/active_support/dependencies.rb:242:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.15/lib/active_support/dependencies.rb:225:in `load_dependency'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.15/lib/active_support/dependencies.rb:597:in `new_constants_in'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.15/lib/active_support/dependencies.rb:225:in `load_dependency'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.15/lib/active_support/dependencies.rb:242:in `require'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.15/lib/rails/application.rb:103:in `require_environment!'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.15/lib/rails/application.rb:218:in `initialize_tasks'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:176:in `invoke_prerequisites'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:157:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/bin/rake:33
/usr/bin/rake:19:in `load'
/usr/bin/rake:19
Tasks: TOP => db:migrate => environment


                    Can anyone tell, what does this error means? Do we need to initialize the  constant HostObserver?
                    If yes, how do we go about initliazing it?

Thanks,
Nishant





Nishant Jain

unread,
Oct 18, 2012, 2:30:32 PM10/18/12
to puppet...@googlegroups.com
I am using the following version of Ruby :ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]

Ohad Levy

unread,
Oct 19, 2012, 4:11:11 AM10/19/12
to puppet...@googlegroups.com
at the moment the stable version of foreman does not support puppet3.

You could give the current workaround patch a try at [1] and some more details at [2]

Ohad

Thanks,
Nishant





--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/2ibzC-g-bzkJ.

To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Nishant Jain

unread,
Oct 19, 2012, 10:33:31 AM10/19/12
to puppet...@googlegroups.com
Thanks Ohad,
                    Got it working by applying the patch u suggested.
But again it was having error finding the value of $vardir and so have to specify it explicitly in /etc/puppet/puppet.conf and it got working.
Reply all
Reply to author
Forward
0 new messages