Project

General

Profile

Bug #1351

New smart variable and match cannot be entered at same time.

Added by Steve Traylen over 7 years ago. Updated almost 7 years ago.

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

Description

Following on from IRC:

Foreman 0.4.0

If I add a new smart variable to a class and also add a match within the same form
then the smart variable is not saved.

e.g entering a smart variable form of:

name=editfirewall
default value=true
type validate=list
validator constraint=true, false
order=fqdn,hostgrou,os,domain
match=fqdn=lxfssm4408.example.ch
value=true

results in a log of

Parameters: {"commit"=>"Submit", "authenticity_token"=>"QWtrc1fTFhDiKpkk2AcNMtNBp4eEc/1oXGdX2cKTbJk=", "id"=>"firewall", "puppetclass"=>{"lookup_keys_attributes"=>{"new_lookup_keys"=>{"default_value"=>"", "validator_rule"=>"", "updated_at"=>"1322075394", "lookup_values_attributes"=>{"new_lookup_values"=>{"value"=>"", "_destroy"=>"", "match"=>""}}, "path"=>"fqdn\r\nhostgroup\r\nos\r\ndomain", "_destroy"=>"", "description"=>"", "validator_type"=>"", "key"=>""}, "new_1322075399382"=>{"default_value"=>"true", "validator_rule"=>"true,false", "updated_at"=>"1322075394", "lookup_values_attributes"=>{"new_1322075455358"=>{"value"=>"false", "_destroy"=>"", "match"=>"fqdn=lxfssm4408.example.ch"}, "new_lookup_values"=>{"value"=>"", "_destroy"=>"", "match"=>""}}, "path"=>"fqdn\r\nhostgroup\r\nos\r\ndomain", "_destroy"=>"", "description"=>"Use puppet firewall rules.", "validator_type"=>"list", "key"=>"editfirewall"}}, "name"=>"firewall", "environment_ids"=>["6", "", "10", "", "9", "", "14", ""], "hostgroup_ids"=>["", "", "", "", "", "", "", "", "", "", ""]}}

but the variable is not saved.

Workaround given on IRC.

Add the smart variable first with no match conditions and then add the match conditions as separate
form submits.

Associated revisions

Revision 7a2e06bd (diff)
Added by Amos Benari almost 7 years ago

fixes #1351 New smart variable and match cannot be entered at same time.

History

#1 Updated by Ohad Levy over 7 years ago

  • Target version set to 1.0

#2 Updated by Ohad Levy over 7 years ago

  • Assignee set to Amos Benari

@Amos, this seems like the template html used to add a new variable is actually inside the form, so the default submit would always include it.

more then that, the error can't be shown, as the whole div is hidden.

I tried to have a look, but it breaks a bit the pills structure, do you mind taking a look?

#3 Updated by Tray Torrance about 7 years ago

I'm hitting this at the nightly release I installed last tuesday, as well. Threw me for quite the loop, as they show up as existing under the "Smart Variables" section of the associated puppet class, but not in the general listing page for "Smart Variables".

-torrancew

#4 Updated by Amos Benari almost 7 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF