Project

General

Profile

Bug #2726

Smart Class Parameter - over-ride match value unable to set yaml

Added by Matthew Ceroni about 6 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Category:
Smart Variables
Target version:
Difficulty:
Triaged:
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:

Description

When creating a Smart Class Parameter, I am able to over ride the default value, set type to yaml and input validated yaml into the default value box.

If I then add a matcher-value combination of hostgroup = engineering and try to override with yaml it fails to save. I am however able to set the value to a simple value (ie: string). There are no errors reported in the foreman log.

I am running version 1.1stable on CentOS v6.


Related issues

Related to Foreman - Bug #3889: No validation errors for nested class parameters on Puppet class edit pageClosed2013-12-16

Associated revisions

Revision cfc2bb66 (diff)
Added by Stephen Benjamin over 5 years ago

fixes #2726 - smart class parameter override fails validation

Revision ddfc6c4f (diff)
Added by Stephen Benjamin over 5 years ago

fixes #2726 - smart class parameter override fails validation

(cherry picked from commit cfc2bb662f49d8216c2388ab35dd87af295474d0)

History

#1 Updated by Luke Kreczko about 6 years ago

Same problem here with foreman 1.2 (latest) on Scientific Linux 6.4. It is possible to save the document if specifying 'hash' instead of 'yaml' (and 'string' would work as well I guess).

#2 Updated by Matthew Ceroni about 6 years ago

Luke Kreczko wrote:

Same problem here with foreman 1.2 (latest) on Scientific Linux 6.4. It is possible to save the document if specifying 'hash' instead of 'yaml' (and 'string' would work as well I guess).

Are you able to specify complex data structures using string or hash? I was using yaml to define an array with embedded hashes, which in turn contain arrays.

As an example I had the following in JSON:

{"pam_files":["system-auth-ac","password-auth-ac"],"access_control_list":[{"comment":"User root should be allowed to get access via cron .. tty5 tty6","permission":"+","name":"root","origins":["cron","crond",":0","tty1","tty2","tty3","tty4","tty5","tty6"]}]}

Not being able to over-ride is kind of a big issue for me right now. This above data structure is used in a module that configures the /etc/security/access.conf file. I was trying to over-ride it based on the hostgroup (each hostgroup represents a specific department).

#3 Updated by Tim Robinson about 6 years ago

Same issue here with YAML working when input as an override from the host paramaters screen but not saving when using 'Add Matcher-Value' in class config. Foreman 1.1

#4 Updated by Andy Bohne about 6 years ago

+1

Foreman 1.2 on RHEL 6 here.

#5 Updated by Dominic Cleal about 6 years ago

  • Description updated (diff)
  • Target version set to 1.3.0

#6 Updated by Lukas Zapletal about 6 years ago

  • Target version deleted (1.3.0)

#7 Updated by Jason Ashby almost 6 years ago

This bug is still open, right? I had this issue on 1.2.2 and now also 1.3.0 with yaml and hashes, whether nested or just one level deep. Right now I'm using heira as a "workaround", but would prefer to have my data all in Foreman.

#8 Updated by Jason Ashby almost 6 years ago

Actually, looks like I was entering hashes incorrectly. I was using JSON format, but it seems Foreman expects a hash as yaml, e.g.:

node: 
  network: 
    host: 127.0.0.1
  index: 
    number_of_shards: 5
    number_of_replicas: 0
  path:
    data: /usr/local/elasticsearch/data

This sounds different than the problem described in this issue.

An error message would be helpful when submitting changes to class parameters if they fail. Currently, it just redirects to the same edit page with no message. FYI when I set log_level to debug, I see this in the logs:

#<OrderedHash {:"class_params.default_value"=>["is invalid"]}>

#9 Updated by Andy Bohne almost 6 years ago

Jason Ashby wrote:

An error message would be helpful when submitting changes to class parameters if they fail. Currently, it just redirects to the same edit page with no message.

This is probably my biggest aggravation with foreman. An error message in the UI would be invaluable in helping to determine what the issue is.

#10 Updated by Dominic Cleal almost 6 years ago

  • Related to Bug #3889: No validation errors for nested class parameters on Puppet class edit page added

#11 Updated by Dominic Cleal almost 6 years ago

I've sent a patch in the related issue #3889, if you get the chance to try it. I haven't tried reproducing this YAML issue yet, but at least that small patch should cause validation errors to be displayed in the UI.

#12 Updated by Peter Gustafsson over 5 years ago

Hi, I'm hitting the same issue in foreman 1.3.2:

i can add below yaml to override default value, but when i'm trying to add the yaml as an hostgroup match it fails to save.

test1:
network_address: 192.168.122.0
netmask: 255.255.255.0
gateway: 192.168.122.1
test2:
network_address: 192.168.123.0
netmask: 255.255.255.0
gateway: 192.168.122.1

Br, Peter

#13 Updated by Stephen Benjamin over 5 years ago

  • Assignee set to Stephen Benjamin
  • Target version set to 1.9.1

#14 Updated by Dominic Cleal over 5 years ago

  • Category set to Smart Variables
  • Status changed from New to Ready For Testing

#15 Updated by Dominic Cleal over 5 years ago

  • Legacy Backlogs Release (now unused) set to 5

#16 Updated by Anonymous over 5 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF