Class parameter changes fail silently

I'm running into a problem wherein I've set class parameter overrides for a
specific host in foreman, and in some cases foreman will reject the new
values. When this occurs, hitting the 'submit' button will return back to
the foreman class edit screen.

A more specific scenario: Overriding class parameter for a specific host,
using YAML as the type

When I provide the following YAML…

··· --- templates: altid: name: /etc/logrotate.d/altid.conf template: logrotate/altid.erb equella: name: /etc/logrotate.d/equella.conf template: logrotate/equella.erb

to a class in foreman, I’ve noticed that after hitting submit, the edit
action will fail silently. I’m confused as this appears to be valid YAML,
but not having an error message on the screen is a little more weird. I’m
curious if anyone else has seen the same behavior?

This is a bug I ran into as well.

http://projects.theforeman.org/issues/2726

From what I can tell, foreman is not parsing multiple lines of yaml in a
correct fashion as a single line of yaml will be accepted correctly, while
multiple lines will fail silently. I meant to look into this more but
haven't had time, especially since nothing is logged when it silently eats
the yaml.

··· On Monday, December 9, 2013 5:11:10 PM UTC-5, Luke Baker wrote: > > I'm running into a problem wherein I've set class parameter overrides for > a specific host in foreman, and in some cases foreman will reject the new > values. When this occurs, hitting the 'submit' button will return back to > the foreman class edit screen. > > A more specific scenario: Overriding class parameter for a specific host, > using YAML as the type > > When I provide the following YAML.. > > --- > templates: > altid: > name: /etc/logrotate.d/altid.conf > template: logrotate/altid.erb > equella: > name: /etc/logrotate.d/equella.conf > template: logrotate/equella.erb > > > to a class in foreman, I've noticed that after hitting submit, the edit > action will fail silently. I'm confused as this appears to be valid YAML, > but not having an error message on the screen is a little more weird. I'm > curious if anyone else has seen the same behavior? >

We've been battling with this annoying bug as well. The best workaround
that we have found is to not edit parameters directly on the puppet class,
but instead just add the module to a hostgroup and edit the parameters
through the hostgroup parameter settings. We've had much better luck by not
editing from the Puppet Class page directly, especially with yaml
parameters.

··· On Friday, December 13, 2013 1:26:13 PM UTC-8, Andy Bohne wrote: > > This is a bug I ran into as well. > > http://projects.theforeman.org/issues/2726 > > From what I can tell, foreman is not parsing multiple lines of yaml in a > correct fashion as a single line of yaml will be accepted correctly, while > multiple lines will fail silently. I meant to look into this more but > haven't had time, especially since nothing is logged when it silently eats > the yaml. > > On Monday, December 9, 2013 5:11:10 PM UTC-5, Luke Baker wrote: >> >> I'm running into a problem wherein I've set class parameter overrides for >> a specific host in foreman, and in some cases foreman will reject the new >> values. When this occurs, hitting the 'submit' button will return back to >> the foreman class edit screen. >> >> A more specific scenario: Overriding class parameter for a specific host, >> using YAML as the type >> >> When I provide the following YAML.. >> >> --- >> templates: >> altid: >> name: /etc/logrotate.d/altid.conf >> template: logrotate/altid.erb >> equella: >> name: /etc/logrotate.d/equella.conf >> template: logrotate/equella.erb >> >> >> to a class in foreman, I've noticed that after hitting submit, the edit >> action will fail silently. I'm confused as this appears to be valid YAML, >> but not having an error message on the screen is a little more weird. I'm >> curious if anyone else has seen the same behavior? >> >

There's a PR which should at leas fix the display of errors (#1093) which
you could test if you like :slight_smile:

Any instructions on how to backport to 1.3.1? :slight_smile:

I don't see the section in app/controllers/puppetclasses_controller.rb that
begins with def find_by_name

··· On Thursday, December 19, 2013 8:13:32 AM UTC-5, Greg Sutcliffe wrote: > > There's a PR which should at leas fix the display of errors (#1093) which > you could test if you like :) >