Import Puppet Classes giving No Method Error

Hi,

I am using Puppet version 4.7.0 and Foreman version 1.12.4.
After immediate installation of foreman-installer, on-click of Configure ->
Puppet Classes I am getting the following error and not allowing me import
puppet classes through foreman UI.

··· =====================================================================================================================================

*Oops, we’re sorry but something went wrong *undefined method `total_hosts’
for #Puppetclass:0x007f92a1cac610

Back https://10.65.248.147/
Documentation
http://www.theforeman.org/manuals/1.12/index.html#7.3GettingHelp

NoMethodError
*undefined method total_hosts' for #<Puppetclass:0x007f92a1cac610>* /opt/rh/sclo-ror42/root/usr/share/gems/gems/activemodel-4.2.5.1/lib/active_model/attribute_methods.rb:433:inmethod_missing’
/usr/share/foreman/app/views/puppetclasses/index.html.erb:28:in block in _app_views_puppetclasses_index_html_erb___2314841949541106154_70133877292380' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/relation/delegation.rb:46:ineach’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/relation/delegation.rb:46:in
each' /usr/share/foreman/app/views/puppetclasses/index.html.erb:19:in_app_views_puppetclasses_index_html_erb___2314841949541106154_70133877292380’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4.2.5.1/lib/action_view/template.rb:145:in
block in render' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/notifications.rb:166:ininstrument’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4.2.5.1/lib/action_view/template.rb:333:in
instrument' /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4.2.5.1/lib/action_view/template.rb:143:inrender’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4.2.5.1/lib/action_view/renderer/template_renderer.rb:54:in
block (2 levels) in render_template' /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4.2.5.1/lib/action_view/renderer/abstract_renderer.rb:39:inblock in instrument’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/notifications.rb:164:in
block in instrument' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/notifications/instrumenter.rb:20:ininstrument’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/notifications.rb:164:in
instrument' /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4.2.5.1/lib/action_view/renderer/abstract_renderer.rb:39:ininstrument’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4.2.5.1/lib/action_view/renderer/template_renderer.rb:53:in
block in render_template' /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4.2.5.1/lib/action_view/renderer/template_renderer.rb:61:inrender_with_layout’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4.2.5.1/lib/action_view/renderer/template_renderer.rb:52:in
render_template' /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4.2.5.1/lib/action_view/renderer/template_renderer.rb:14:inrender’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4.2.5.1/lib/action_view/renderer/renderer.rb:46:in
render_template' /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4.2.5.1/lib/action_view/renderer/renderer.rb:27:inrender’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4.2.5.1/lib/action_view/rendering.rb:100:in
_render_template' /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_controller/metal/streaming.rb:217:in_render_template’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4.2.5.1/lib/action_view/rendering.rb:83:in
render_to_body' /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_controller/metal/rendering.rb:32:inrender_to_body’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_controller/metal/renderers.rb:37:in
render_to_body' /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/abstract_controller/rendering.rb:25:inrender’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_controller/metal/rendering.rb:16:in
render' /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_controller/metal/instrumentation.rb:44:inblock (2 levels) in render’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/core_ext/benchmark.rb:12:in
block in ms' /opt/rh/rh-ruby22/root/usr/share/ruby/benchmark.rb:303:inrealtime’

Can anyone help me to resolve this issue?

Thanks and Regards,
Amrit

Hi Amrit,

It looks like one of the database migrations did not run correctly, please
execute 'foreman-rake db:migrate' on the server and try again.

··· On Wed, Nov 16, 2016 at 9:04 AM, Amrit Atmajit wrote:

Hi,

I am using Puppet version 4.7.0 and Foreman version 1.12.4.
After immediate installation of foreman-installer, on-click of Configure
-> Puppet Classes I am getting the following error and not allowing me
import puppet classes through foreman UI.

============================================================

*Oops, we’re sorry but something went wrong *undefined method
`total_hosts’ for #Puppetclass:0x007f92a1cac610

Back https://10.65.248.147/
Documentation
http://www.theforeman.org/manuals/1.12/index.html#7.3GettingHelp

NoMethodError
*undefined method total_hosts' for #<Puppetclass:0x007f92a1cac610>* /opt/rh/sclo-ror42/root/usr/share/gems/gems/activemodel-4. 2.5.1/lib/active_model/attribute_methods.rb:433:inmethod_missing’
/usr/share/foreman/app/views/puppetclasses/index.html.erb:28:in block in _app_views_puppetclasses_index_html_erb___2314841949541106154_ 70133877292380' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord- 4.2.5.1/lib/active_record/relation/delegation.rb:46:ineach’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-
4.2.5.1/lib/active_record/relation/delegation.rb:46:in each' /usr/share/foreman/app/views/puppetclasses/index.html.erb:19:inapp_views_puppetclasses_index_html_erb___2314841949541106154
70133877292380’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4.
2.5.1/lib/action_view/template.rb:145:in block in render' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport- 4.2.5.1/lib/active_support/notifications.rb:166:ininstrument’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4.
2.5.1/lib/action_view/template.rb:333:in instrument' /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4. 2.5.1/lib/action_view/template.rb:143:inrender’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4.
2.5.1/lib/action_view/renderer/template_renderer.rb:54:in block (2 levels) in render_template' /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4. 2.5.1/lib/action_view/renderer/abstract_renderer.rb:39:inblock in
instrument’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-
4.2.5.1/lib/active_support/notifications.rb:164:in block in instrument' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport- 4.2.5.1/lib/active_support/notifications/instrumenter.rb:20:ininstrument’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-
4.2.5.1/lib/active_support/notifications.rb:164:in instrument' /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4. 2.5.1/lib/action_view/renderer/abstract_renderer.rb:39:ininstrument’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4.
2.5.1/lib/action_view/renderer/template_renderer.rb:53:in block in render_template' /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4. 2.5.1/lib/action_view/renderer/template_renderer.rb:61:inrender_with_layout’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4.
2.5.1/lib/action_view/renderer/template_renderer.rb:52:in
render_template' /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4. 2.5.1/lib/action_view/renderer/template_renderer.rb:14:inrender’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4.
2.5.1/lib/action_view/renderer/renderer.rb:46:in render_template' /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4. 2.5.1/lib/action_view/renderer/renderer.rb:27:inrender’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4.
2.5.1/lib/action_view/rendering.rb:100:in _render_template' /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4. 2.5.1/lib/action_controller/metal/streaming.rb:217:in_render_template’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/actionview-4.
2.5.1/lib/action_view/rendering.rb:83:in render_to_body' /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4. 2.5.1/lib/action_controller/metal/rendering.rb:32:inrender_to_body’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.
2.5.1/lib/action_controller/metal/renderers.rb:37:in render_to_body' /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4. 2.5.1/lib/abstract_controller/rendering.rb:25:inrender’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.
2.5.1/lib/action_controller/metal/rendering.rb:16:in render' /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4. 2.5.1/lib/action_controller/metal/instrumentation.rb:44:inblock (2
levels) in render’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-
4.2.5.1/lib/active_support/core_ext/benchmark.rb:12:in block in ms' /opt/rh/rh-ruby22/root/usr/share/ruby/benchmark.rb:303:inrealtime’

=========================================================================

Can anyone help me to resolve this issue?

Thanks and Regards,
Amrit


You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.


Have a nice day,
Tomer Brisker
Red Hat Engineering