Cannot modify puppet classes associated with hostgroups; foreman upgrade from 1.0.2 to 1.1

Hello all,

I did some searching and didn't find any reference to the issue I've run
into so far, so I figured it would be OK to post a new thread here. If I
did miss something, please accept my apologies for the additional noise.

I recently upgraded from Foreman 1.0.2 to Foreman 1.1 (old, I know…) and
for the most part the upgrade was solid and there were no issues. However,
I missed testing the adding/removing of puppet classes to existing
hostgroups and creating new hostgroups with classes; today, I went through
the motions and found that I started getting errors:

adding

undefined method `eq' for nil:NilClass

NoMethodError
undefined method eq' for nil:NilClass lib/audit_extensions.rb:53:in ensure_audtiable_and_associated_name'
app/controllers/hostgroups_controller.rb:76:in update' lib/foreman/thread_session.rb:31:in clear_thread'

removing

undefined method `eq' for nil:NilClass

NoMethodError
undefined method eq' for nil:NilClass lib/core_extensions.rb:5:in delete_records'
lib/core_extensions.rb:4:in each' lib/core_extensions.rb:4:in delete_records'
app/controllers/hostgroups_controller.rb:76:in update' lib/foreman/thread_session.rb:31:in clear_thread'

I've attached a full text file as well with debugging.

I'm able to successfully and/remove classes to individual nodes that are
part of the hostgroup via the GUI, it only fails when modifying the
hostgroup or creating a new hostgroup and specifying classes. I can also
successfully run the SQL queries manifest in the debug logs without an
issue to add/remove classes to the hostgroup.

During the installation process I did import the DB from a SQL dump and
migrated it using rake. I did notice however, that a table was re-named in
versions: hostgroups_puppetclasses (1.0.2) to hostgroup_classes (1.1
stable). I had to import the table in order to get all of my hostgroups
and parameters to display.

I'm sure that there may be a table name conflict somewhere, but I am not
100% sure.

Has anyone else run into this issue before? If so, any suggestions would
be appreciated. Our Foreman installation has been extremely useful and
served its purpose well, so I'm hoping that this is something minor.

Thank you!
John DeSantis

foreman1.1-nomethoderror.txt (12.4 KB)

Hello all,

During the installation process I did import the DB from a SQL dump and
> migrated it using rake. I did notice however, that a table was re-named in
> versions: hostgroups_puppetclasses (1.0.2) to hostgroup_classes (1.1
> stable). I had to import the table in order to get all of my hostgroups
> and parameters to display.
> I'm sure that there may be a table name conflict somewhere, but I am not
> 100% sure.

It turns out that there was a table migration that needed to be performed
manually - the one that adds auditable and associated names to the audit
table.

Looking in my history, it's clear that I inadvertently reversed the order
of operations; ran migrations and then imported DB! This is clearly a
testament to the solid project. Everything still worked despite "undoing"
the schema.

Anyways, hopefully this will help others if they run into the same issue.

John DeSantis

··· On Monday, April 24, 2017 at 2:59:18 PM UTC-4, John Desantis wrote: > > Hello all, > > I did some searching and didn't find any reference to the issue I've run > into so far, so I figured it would be OK to post a new thread here. If I > did miss something, please accept my apologies for the additional noise. > > I recently upgraded from Foreman 1.0.2 to Foreman 1.1 (old, I know..) and > for the most part the upgrade was solid and there were no issues. However, > I missed testing the adding/removing of puppet classes to existing > hostgroups and creating new hostgroups with classes; today, I went through > the motions and found that I started getting errors: > > # adding > > undefined method `eq' for nil:NilClass > > NoMethodError > undefined method `eq' for nil:NilClass > lib/audit_extensions.rb:53:in `ensure_audtiable_and_associated_name' > app/controllers/hostgroups_controller.rb:76:in `update' > lib/foreman/thread_session.rb:31:in `clear_thread' > > > # removing > > undefined method `eq' for nil:NilClass > > NoMethodError > undefined method `eq' for nil:NilClass > lib/core_extensions.rb:5:in `delete_records' > lib/core_extensions.rb:4:in `each' > lib/core_extensions.rb:4:in `delete_records' > app/controllers/hostgroups_controller.rb:76:in `update' > lib/foreman/thread_session.rb:31:in `clear_thread' > > I've attached a full text file as well with debugging. > > I'm able to successfully and/remove classes to individual nodes that are > part of the hostgroup via the GUI, it only fails when modifying the > hostgroup or creating a new hostgroup and specifying classes. I can also > successfully run the SQL queries manifest in the debug logs without an > issue to add/remove classes to the hostgroup. > > During the installation process I did import the DB from a SQL dump and > migrated it using rake. I did notice however, that a table was re-named in > versions: hostgroups_puppetclasses (1.0.2) to hostgroup_classes (1.1 > stable). I had to import the table in order to get all of my hostgroups > and parameters to display. > > I'm sure that there may be a table name conflict somewhere, but I am not > 100% sure. > > Has anyone else run into this issue before? If so, any suggestions would > be appreciated. Our Foreman installation has been extremely useful and > served its purpose well, so I'm hoping that this is something minor. > > Thank you! > John DeSantis > >