Undefined method `reports'

Hi,
I recently upgraded from Foreman 1.1.1 to 1.2.2 and get the error
"undefined method `reports'" when clicking on a host view in the Foreman
GUI. e.g. http://master.example.com:4000/hosts/foo.example.com, gives me
"Oops, something with wrong" with this stack trace:

NoMethodError
*undefined method reports' for #<Host::Base:0x7fe55e06ba80>* app/models/report.rb:142:insummarise'
app/models/report.rb:138:in each' app/models/report.rb:138:insummarise'
app/controllers/hosts_controller.rb:62:in show' app/controllers/hosts_controller.rb:56:inshow'
lib/foreman/thread_session.rb:31:in `clear_thread'

Puppetmaster and foreman host:

CentOS 6.4
ruby 1.8.7
Puppet 3.1.1
puppetDB 1.4
Apache 2.4.6, passenger 4.0.5

I was using storeconfigs, but moved to puppetdb since Foreman 1.2 now
requires it. I was using a shared postgres db between puppet and foreman,
but now only foreman uses the postgres db, and puppetdb has its own
postgres db. I checked logs for apache, foreman, puppet, puppetdb, and
system logs, but all look clean.

I did not install Foreman from packages, but from git:

cd /usr/local
git clone git@github.com:theforeman/foreman.git foreman-1.2.2
cd foreman-1.2.2
git checkout tags/1.2.2
bundle exec rake db:migrate RAILS_ENV=production
bundle install
RAILS_ENV=production bundle exec rake assets:precompile

Here is the master's /etc/puppet/puppet.conf:
[main]
# The Puppet log directory.
# The default value is '$vardir/log'.
logdir = /var/log/puppet

# Where Puppet PID files are kept.
# The default value is '$vardir/run'.
rundir = /var/run/puppet

# Where SSL certificates are kept.
# The default value is '$confdir/ssl'.
ssldir = $vardir/ssl

server = master.example.com
pluginsync = true

# puppet run (trigger puppet from puppet master)
listen = true
modulepath=/etc/puppet/modules

[agent]
environment = production
# The file in which puppetd stores a list of the classes
# associated with the retrieved configuratiion. Can be loaded in
# the separate puppet executable using the --loadclasses
# option.
# The default value is '$confdir/classes.txt'.
classfile = $vardir/classes.txt

# Where puppetd caches the local configuration.  An
# extension indicating the cache format is added automatically.
# The default value is '$confdir/localconfig'.
localconfig = $vardir/localconfig

report = true

[master]
reports = foreman
facts_terminus = yaml
node_terminus = exec
external_nodes = /etc/puppet/node.rb
dns_alt_names=puppet,puppet.example.com,master,master.example.com

apache/passenger

ssl_client_header = SSL_CLIENT_S_DN
ssl_client_verify_header = SSL_CLIENT_VERIFY

storeconfigs

storeconfigs = true
storeconfigs_backend = puppetdb

Any insight or troubleshooting tips would be appreciated.

> Hi,
> I recently upgraded from Foreman 1.1.1 to 1.2.2 and get the error
> "undefined method reports&#39;&quot; when clicking on a host view in the Foreman &gt; GUI. e.g. http://master.example.com:4000/hosts/foo.example.com, gives me &gt; &quot;Oops, something with wrong&quot; with this stack trace: &gt; &gt; *NoMethodError* &gt; *undefined methodreports' for #<Host::Base:0x7fe55e06ba80>*
>

Hmm… any chance you didn't run the migrations? all Host instances should
have the type Host::Managed in the db.

You could manually fix this by changing the type column of your hosts.

Ohad

··· On Sat, Sep 7, 2013 at 5:31 PM, Jason Ashby wrote:

app/models/report.rb:142:in summarise' app/models/report.rb:138:ineach’
app/models/report.rb:138:in summarise' app/controllers/hosts_controller.rb:62:inshow’
app/controllers/hosts_controller.rb:56:in show' lib/foreman/thread_session.rb:31:inclear_thread’

Puppetmaster and foreman host:

CentOS 6.4
ruby 1.8.7
Puppet 3.1.1
puppetDB 1.4
Apache 2.4.6, passenger 4.0.5

I was using storeconfigs, but moved to puppetdb since Foreman 1.2 now
requires it. I was using a shared postgres db between puppet and foreman,
but now only foreman uses the postgres db, and puppetdb has its own
postgres db. I checked logs for apache, foreman, puppet, puppetdb, and
system logs, but all look clean.

I did not install Foreman from packages, but from git:

cd /usr/local
git clone git@github.com:theforeman/foreman.git foreman-1.2.2
cd foreman-1.2.2
git checkout tags/1.2.2
bundle exec rake db:migrate RAILS_ENV=production
bundle install
RAILS_ENV=production bundle exec rake assets:precompile

Here is the master’s /etc/puppet/puppet.conf:
[main]
# The Puppet log directory.
# The default value is ‘$vardir/log’.
logdir = /var/log/puppet

# Where Puppet PID files are kept.
# The default value is '$vardir/run'.
rundir = /var/run/puppet

# Where SSL certificates are kept.
# The default value is '$confdir/ssl'.
ssldir = $vardir/ssl

server = master.example.com
pluginsync = true

# puppet run (trigger puppet from puppet master)
listen = true
modulepath=/etc/puppet/modules

[agent]
environment = production
# The file in which puppetd stores a list of the classes
# associated with the retrieved configuratiion. Can be loaded in
# the separate puppet executable using the --loadclasses
# option.
# The default value is ‘$confdir/classes.txt’.
classfile = $vardir/classes.txt

# Where puppetd caches the local configuration.  An
# extension indicating the cache format is added automatically.
# The default value is '$confdir/localconfig'.
localconfig = $vardir/localconfig

report = true

[master]
reports = foreman
facts_terminus = yaml
node_terminus = exec
external_nodes = /etc/puppet/node.rb
dns_alt_names=puppet,puppet.example.com,master,master.example.com

apache/passenger

ssl_client_header = SSL_CLIENT_S_DN
ssl_client_verify_header = SSL_CLIENT_VERIFY

storeconfigs

storeconfigs = true
storeconfigs_backend = puppetdb

Any insight or troubleshooting tips would be appreciated.


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 http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/groups/opt_out.

Yep, that fixed it! Thanks a bunch Ohad.

I didn't read through the Foreman 1.2 release notes carefully to see that
puppetDB was now required, so initially I was attempting to get
storeconfigs working with Foreman 1.2 and saw this post:

https://groups.google.com/forum/#!topic/puppet-users/xN834-IPkSo

which said to delete/drop the type column in the hosts table. I'll reply
to that post with an FYI.

··· On Saturday, September 7, 2013 2:20:57 PM UTC-4, ohad wrote: > > > > > On Sat, Sep 7, 2013 at 5:31 PM, Jason Ashby <jas...@gmail.com > > wrote: > >> Hi, >> I recently upgraded from Foreman 1.1.1 to 1.2.2 and get the error >> "undefined method `reports'" when clicking on a host view in the Foreman >> GUI. e.g. http://master.example.com:4000/hosts/foo.example.com, gives >> me "Oops, something with wrong" with this stack trace: >> >> *NoMethodError* >> *undefined method `reports' for #* >> > > Hmm.. any chance you didn't run the migrations? all Host instances should > have the type Host::Managed in the db. > > You could manually fix this by changing the type column of your hosts. > > Ohad > > >> >> app/models/report.rb:142:in `summarise' >> app/models/report.rb:138:in `each' >> app/models/report.rb:138:in `summarise' >> app/controllers/hosts_controller.rb:62:in `show' >> app/controllers/hosts_controller.rb:56:in `show' >> lib/foreman/thread_session.rb:31:in `clear_thread' >> >> >> Puppetmaster and foreman host: >> >> CentOS 6.4 >> ruby 1.8.7 >> Puppet 3.1.1 >> puppetDB 1.4 >> Apache 2.4.6, passenger 4.0.5 >> >> I was using storeconfigs, but moved to puppetdb since Foreman 1.2 now >> requires it. I was using a shared postgres db between puppet and foreman, >> but now only foreman uses the postgres db, and puppetdb has its own >> postgres db. I checked logs for apache, foreman, puppet, puppetdb, and >> system logs, but all look clean. >> >> I did not install Foreman from packages, but from git: >> >> cd /usr/local >> git clone git@github.com:theforeman/foreman.git foreman-1.2.2 >> cd foreman-1.2.2 >> git checkout tags/1.2.2 >> bundle exec rake db:migrate RAILS_ENV=production >> bundle install >> RAILS_ENV=production bundle exec rake assets:precompile >> >> Here is the master's /etc/puppet/puppet.conf: >> [main] >> # The Puppet log directory. >> # The default value is '$vardir/log'. >> logdir = /var/log/puppet >> >> # Where Puppet PID files are kept. >> # The default value is '$vardir/run'. >> rundir = /var/run/puppet >> >> # Where SSL certificates are kept. >> # The default value is '$confdir/ssl'. >> ssldir = $vardir/ssl >> >> server = master.example.com >> pluginsync = true >> >> # puppet run (trigger puppet from puppet master) >> listen = true >> modulepath=/etc/puppet/modules >> >> [agent] >> environment = production >> # The file in which puppetd stores a list of the classes >> # associated with the retrieved configuratiion. Can be loaded in >> # the separate ``puppet`` executable using the ``--loadclasses`` >> # option. >> # The default value is '$confdir/classes.txt'. >> classfile = $vardir/classes.txt >> >> # Where puppetd caches the local configuration. An >> # extension indicating the cache format is added automatically. >> # The default value is '$confdir/localconfig'. >> localconfig = $vardir/localconfig >> >> report = true >> >> [master] >> reports = foreman >> facts_terminus = yaml >> node_terminus = exec >> external_nodes = /etc/puppet/node.rb >> dns_alt_names=puppet,puppet.example.com,master,master.example.com >> >> # apache/passenger >> ssl_client_header = SSL_CLIENT_S_DN >> ssl_client_verify_header = SSL_CLIENT_VERIFY >> >> # storeconfigs >> storeconfigs = true >> storeconfigs_backend = puppetdb >> >> Any insight or troubleshooting tips would be appreciated. >> >> -- >> 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-user...@googlegroups.com . >> To post to this group, send email to forema...@googlegroups.com >> . >> Visit this group at http://groups.google.com/group/foreman-users. >> For more options, visit https://groups.google.com/groups/opt_out. >> > >

OK I see. I think my understanding of storeconfigs was wrong. Looks
like I was previously using an ActiveRecord-based storeconfigs and perhaps
confused myself when reading Foreman :: Manual

ActiveRecord-based storeconfigs / database sharing now unsupported
>
> Previously it was suggested that a single database could be shared between
> Puppet ActiveRecord-based storeconfigs and Foreman, which would be used to
> import data from Puppet - this configuration was deprecated in Foreman 1.1
> and is now unsupported in 1.2. Foreman must be configured with a standalone
> database, then configure either an ENC or fact and report uploads, which
> provides most of the same functionality as database sharing without the
> associated issues.
>
> Puppet 3 also deprecated the use of ActiveRecord-based storeconfigs and it
> is now recommended to use PuppetDB instead for storeconfigs and exported
> resources. This can be used alongside Foreman as the two do not need to
> interact.
>

Then again, I had upgraded to puppet 3.x a few months ago, and apparently
ActiveRecord storeconfigs was deprecated in puppet 3 as the Foreman docs
above state, so maybe I wasn't using ActiveRecord-based (or was it
deprecated in puppet 3, but still supported?).

··· On Saturday, September 7, 2013 3:37:29 PM UTC-4, Sam Kottler wrote: > > > > ----- Original Message ----- > > From: "Jason Ashby" <jas...@gmail.com > > > To: forema...@googlegroups.com > > Sent: Saturday, September 7, 2013 3:28:00 PM > > Subject: Re: [foreman-users] undefined method `reports' > > > > Yep, that fixed it! Thanks a bunch Ohad. > > > > I didn't read through the Foreman 1.2 release notes carefully to see > that > > puppetDB was now required, so initially I was attempting to get > > storeconfigs working with Foreman 1.2 and saw this post: > > PuppetDB isn't required for 1.2, but it's obviously an option. Did it say > somewhere in the manual that PuppetDB was required or were you implying > that it was for your use case? If it's the former which section was unclear > so we can improve it? > > > > > https://groups.google.com/forum/#!topic/puppet-users/xN834-IPkSo > > > > which said to delete/drop the type column in the hosts table. I'll > reply > > to that post with an FYI. > > > > > > On Saturday, September 7, 2013 2:20:57 PM UTC-4, ohad wrote: > > > > > > > > > > > > > > > On Sat, Sep 7, 2013 at 5:31 PM, Jason Ashby <jas...@gmail.com > > > > > wrote: > > > > > >> Hi, > > >> I recently upgraded from Foreman 1.1.1 to 1.2.2 and get the error > > >> "undefined method `reports'" when clicking on a host view in the > Foreman > > >> GUI. e.g. http://master.example.com:4000/hosts/foo.example.com, > gives > > >> me "Oops, something with wrong" with this stack trace: > > >> > > >> *NoMethodError* > > >> *undefined method `reports' for #* > > >> > > > > > > Hmm.. any chance you didn't run the migrations? all Host instances > should > > > have the type Host::Managed in the db. > > > > > > You could manually fix this by changing the type column of your hosts. > > > > > > Ohad > > > > > > > > >> > > >> app/models/report.rb:142:in `summarise' > > >> app/models/report.rb:138:in `each' > > >> app/models/report.rb:138:in `summarise' > > >> app/controllers/hosts_controller.rb:62:in `show' > > >> app/controllers/hosts_controller.rb:56:in `show' > > >> lib/foreman/thread_session.rb:31:in `clear_thread' > > >> > > >> > > >> Puppetmaster and foreman host: > > >> > > >> CentOS 6.4 > > >> ruby 1.8.7 > > >> Puppet 3.1.1 > > >> puppetDB 1.4 > > >> Apache 2.4.6, passenger 4.0.5 > > >> > > >> I was using storeconfigs, but moved to puppetdb since Foreman 1.2 now > > >> requires it. I was using a shared postgres db between puppet and > foreman, > > >> but now only foreman uses the postgres db, and puppetdb has its own > > >> postgres db. I checked logs for apache, foreman, puppet, puppetdb, > and > > >> system logs, but all look clean. > > >> > > >> I did not install Foreman from packages, but from git: > > >> > > >> cd /usr/local > > >> git clone git@github.com:theforeman/foreman.git foreman-1.2.2 > > >> cd foreman-1.2.2 > > >> git checkout tags/1.2.2 > > >> bundle exec rake db:migrate RAILS_ENV=production > > >> bundle install > > >> RAILS_ENV=production bundle exec rake assets:precompile > > >> > > >> Here is the master's /etc/puppet/puppet.conf: > > >> [main] > > >> # The Puppet log directory. > > >> # The default value is '$vardir/log'. > > >> logdir = /var/log/puppet > > >> > > >> # Where Puppet PID files are kept. > > >> # The default value is '$vardir/run'. > > >> rundir = /var/run/puppet > > >> > > >> # Where SSL certificates are kept. > > >> # The default value is '$confdir/ssl'. > > >> ssldir = $vardir/ssl > > >> > > >> server = master.example.com > > >> pluginsync = true > > >> > > >> # puppet run (trigger puppet from puppet master) > > >> listen = true > > >> modulepath=/etc/puppet/modules > > >> > > >> [agent] > > >> environment = production > > >> # The file in which puppetd stores a list of the classes > > >> # associated with the retrieved configuratiion. Can be loaded in > > >> # the separate ``puppet`` executable using the ``--loadclasses`` > > >> # option. > > >> # The default value is '$confdir/classes.txt'. > > >> classfile = $vardir/classes.txt > > >> > > >> # Where puppetd caches the local configuration. An > > >> # extension indicating the cache format is added automatically. > > >> # The default value is '$confdir/localconfig'. > > >> localconfig = $vardir/localconfig > > >> > > >> report = true > > >> > > >> [master] > > >> reports = foreman > > >> facts_terminus = yaml > > >> node_terminus = exec > > >> external_nodes = /etc/puppet/node.rb > > >> dns_alt_names=puppet,puppet.example.com,master,master.example.com > > >> > > >> # apache/passenger > > >> ssl_client_header = SSL_CLIENT_S_DN > > >> ssl_client_verify_header = SSL_CLIENT_VERIFY > > >> > > >> # storeconfigs > > >> storeconfigs = true > > >> storeconfigs_backend = puppetdb > > >> > > >> Any insight or troubleshooting tips would be appreciated. > > >> > > >> -- > > >> 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-user...@googlegroups.com . > > >> To post to this group, send email to > > >> forema...@googlegroups.com > > >> . > > >> Visit this group at http://groups.google.com/group/foreman-users. > > >> For more options, visit https://groups.google.com/groups/opt_out. > > >> > > > > > > > > > > -- > > 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-user...@googlegroups.com . > > To post to this group, send email to forema...@googlegroups.com. > > > Visit this group at http://groups.google.com/group/foreman-users. > > For more options, visit https://groups.google.com/groups/opt_out. > > >

> From: "Jason Ashby" <jashby2@gmail.com>
> To: foreman-users@googlegroups.com
> Sent: Saturday, September 7, 2013 3:28:00 PM
> Subject: Re: [foreman-users] undefined method `reports'
>
> Yep, that fixed it! Thanks a bunch Ohad.
>
> I didn't read through the Foreman 1.2 release notes carefully to see that
> puppetDB was now required, so initially I was attempting to get
> storeconfigs working with Foreman 1.2 and saw this post:

PuppetDB isn't required for 1.2, but it's obviously an option. Did it say somewhere in the manual that PuppetDB was required or were you implying that it was for your use case? If it's the former which section was unclear so we can improve it?

··· ----- Original Message -----

https://groups.google.com/forum/#!topic/puppet-users/xN834-IPkSo

which said to delete/drop the type column in the hosts table. I’ll reply
to that post with an FYI.

On Saturday, September 7, 2013 2:20:57 PM UTC-4, ohad wrote:

On Sat, Sep 7, 2013 at 5:31 PM, Jason Ashby <jas...@gmail.com<javascript:> > > > wrote:

Hi,
I recently upgraded from Foreman 1.1.1 to 1.2.2 and get the error
"undefined method `reports’" when clicking on a host view in the Foreman
GUI. e.g. http://master.example.com:4000/hosts/foo.example.com, gives
me “Oops, something with wrong” with this stack trace:

NoMethodError
undefined method `reports’ for #Host::Base:0x7fe55e06ba80

Hmm… any chance you didn’t run the migrations? all Host instances should
have the type Host::Managed in the db.

You could manually fix this by changing the type column of your hosts.

Ohad

app/models/report.rb:142:in summarise' app/models/report.rb:138:ineach’
app/models/report.rb:138:in summarise' app/controllers/hosts_controller.rb:62:inshow’
app/controllers/hosts_controller.rb:56:in show' lib/foreman/thread_session.rb:31:inclear_thread’

Puppetmaster and foreman host:

CentOS 6.4
ruby 1.8.7
Puppet 3.1.1
puppetDB 1.4
Apache 2.4.6, passenger 4.0.5

I was using storeconfigs, but moved to puppetdb since Foreman 1.2 now
requires it. I was using a shared postgres db between puppet and foreman,
but now only foreman uses the postgres db, and puppetdb has its own
postgres db. I checked logs for apache, foreman, puppet, puppetdb, and
system logs, but all look clean.

I did not install Foreman from packages, but from git:

cd /usr/local
git clone git@github.com:theforeman/foreman.git foreman-1.2.2
cd foreman-1.2.2
git checkout tags/1.2.2
bundle exec rake db:migrate RAILS_ENV=production
bundle install
RAILS_ENV=production bundle exec rake assets:precompile

Here is the master’s /etc/puppet/puppet.conf:
[main]
# The Puppet log directory.
# The default value is ‘$vardir/log’.
logdir = /var/log/puppet

# Where Puppet PID files are kept.
# The default value is '$vardir/run'.
rundir = /var/run/puppet

# Where SSL certificates are kept.
# The default value is '$confdir/ssl'.
ssldir = $vardir/ssl

server = master.example.com
pluginsync = true

# puppet run (trigger puppet from puppet master)
listen = true
modulepath=/etc/puppet/modules

[agent]
environment = production
# The file in which puppetd stores a list of the classes
# associated with the retrieved configuratiion. Can be loaded in
# the separate puppet executable using the --loadclasses
# option.
# The default value is ‘$confdir/classes.txt’.
classfile = $vardir/classes.txt

# Where puppetd caches the local configuration.  An
# extension indicating the cache format is added automatically.
# The default value is '$confdir/localconfig'.
localconfig = $vardir/localconfig

report = true

[master]
reports = foreman
facts_terminus = yaml
node_terminus = exec
external_nodes = /etc/puppet/node.rb
dns_alt_names=puppet,puppet.example.com,master,master.example.com

apache/passenger

ssl_client_header = SSL_CLIENT_S_DN
ssl_client_verify_header = SSL_CLIENT_VERIFY

storeconfigs

storeconfigs = true
storeconfigs_backend = puppetdb

Any insight or troubleshooting tips would be appreciated.


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-user...@googlegroups.com <javascript:>.
To post to this group, send email to
forema...@googlegroups.com<javascript:>
.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/groups/opt_out.


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 http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/groups/opt_out.