Bug #2726
closedSmart Class Parameter - over-ride match value unable to set yaml
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.
Updated by Luke Kreczko over 11 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).
Updated by Matthew Ceroni over 11 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).
Updated by Tim Robinson over 11 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
Updated by Dominic Cleal over 11 years ago
- Description updated (diff)
- Target version set to 1.3.0
Updated by Jason Ashby about 11 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.
Updated by Jason Ashby about 11 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"]}>
Updated by Andy Bohne almost 11 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.
Updated by Dominic Cleal almost 11 years ago
- Related to Bug #3889: No validation errors for nested class parameters on Puppet class edit page added
Updated by Dominic Cleal almost 11 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.
Updated by Peter Gustafsson almost 11 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
Updated by Stephen Benjamin almost 11 years ago
- Assignee set to Stephen Benjamin
- Target version set to 1.9.1
Updated by Dominic Cleal almost 11 years ago
- Category set to Parameters
- Status changed from New to Ready For Testing
Updated by Dominic Cleal almost 11 years ago
- Translation missing: en.field_release set to 5
Updated by Anonymous almost 11 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset cfc2bb662f49d8216c2388ab35dd87af295474d0.