The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

Feature #3534

Dashboard should support ability to set variables as arrays in the ENC

Added by Stefan Goethals over 4 years ago. Updated over 1 year ago.

Status:Needs DecisionStart date:04/12/2010
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-
Keywords: customer Affected URL:
Branch: Affected Dashboard version:

Description

New description:

When editing a node, you can add arbitrary key/value pairs as parameters. Currently the value is treated as a string. We need:

  • syntax for array values,
  • correct reading/writing of array values.

Original description:

When assigning a parameter on a node as an array, the external node tool returns it, escaped, as a string,

# /usr/local/puppet-dashboard/bin/external_node 
--- 
name: 
parameters: 
  arraytest: "[ \"one\", \"two\" ]"
classes: 
- puppet::server
...

Related issues

Duplicated by Puppet Dashboard - Bug #6583: Dashboard should support ability to set variables as hash... Duplicate 03/04/2011

History

#1 Updated by Stefan Goethals over 4 years ago

  • Status changed from Unreviewed to Closed

Using the split() function works fine.

#2 Updated by Dan Bode over 4 years ago

  • Status changed from Closed to Re-opened

we need real support for arrays to support proper overrides:

See #4052 for an example.

#3 Updated by David Schmitt over 4 years ago

Using split() indeed works “fine”. Unless you

  • migrate from another tool that supports arrays (like site.pp or any other external node script)
  • have quoting problems
  • don’t want to have to remember which delimiter you need for each variable

#4 Updated by Rein Henrichs over 4 years ago

  • Status changed from Re-opened to Needs Decision
  • Target version set to 1.2.0

Can we use CSV-style delimiters for arrays? (commas are fine unless there’s a comma in the field, in which case it needs to be quoted?)

Example:

foo, bar, “bizz, bazz”

This would be consistent, familiar, and would let us parse it safely with existing tools.

I’m open to other suggestions. Scheduling this tentatively for 1.2.0 while we nail it down a bit more.

#5 Updated by David Schmitt over 4 years ago

I’d really prefer to have arrays input in the UI as multi- fields and have them saved in the database properly. This obviates the need for any quoting or other munging in the UI, the op’s head or the manifest, because the produced YAML would already have a real array.

#6 Updated by Ken Barber over 4 years ago

Lets be serious though – more complex structures will be what is asked for next – like hashes – arrays of arrays etc. etc. Thinking in this direction will cause theoretical conundrums (and head explosion) but should be powerful enough to model anything people throw at the tool. For some reason my mind drifts towards couchdb style documents :–).

#7 Updated by Luke Kanies over 4 years ago

  • Status changed from Needs Decision to Accepted

If the Dashboard supports arrays of values and the final destination supports them, the tool for pulling them down should definitely support them.

#8 Updated by Marc-Olivier Barre about 4 years ago

I’ve just hit this issue. It is indeed annoying. Do we have any examples of a workaround using split() ?

#9 Updated by Stefan Goethals about 4 years ago

An example of the use of split() Hopefully this is useful for some people. in Dashboard i define fw_type as a comma separated string.

class amodule::server {

if ( ! $fw_type ) or ( $fw_type == '' ) {
err( "amodule::server requires a fw_type!" )
exec { "echo 'amodule::server requires a fw_type!'; exit 1": }
} else {
$fw_type_array = split( $fw_type, ',' )
amodule::server::type{ $fw_type_array: }
}

}

define amodule::server::type() {

$fw_type = $name
.....

}

#10 Updated by James Turnbull almost 4 years ago

  • Keywords set to https://support.puppetlabs.com/tickets/266

#11 Updated by James Turnbull almost 4 years ago

  • Keywords deleted (https://support.puppetlabs.com/tickets/266)

#12 Updated by Dan Bode almost 4 years ago

  • Subject changed from Return parameter as array via puppet-dashboard/bin/external_node to Dashboard should support ability to set variables as arrays in the ENC

#13 Updated by James Turnbull over 3 years ago

  • Status changed from Accepted to Needs Decision
  • Assignee set to Nigel Kersten

Note Support URL and link to #4052

#14 Updated by Nigel Kersten over 3 years ago

  • Status changed from Needs Decision to Accepted
  • Assignee deleted (Nigel Kersten)
  • Target version changed from 1.2.0 to 142

#15 Updated by James Turnbull over 3 years ago

  • Target version deleted (142)

#16 Updated by Dan Bode over 3 years ago

  • Tracker changed from Bug to Feature

#17 Updated by Anonymous over 3 years ago

The ENC probably also needs maps added at the same time. The UI and communication paths should be approximately the same for handling both, I expect, at least at the YAML level.

#18 Updated by James Turnbull about 3 years ago

  • Status changed from Accepted to Needs Decision
  • Assignee set to Jason McKerr

This overlaps with the three or four ENC efforts plus some Dashboard/Console UI stuff. Probably needs a call from you regarding how it’s handled.

#19 Updated by Anonymous almost 3 years ago

  • Assignee changed from Jason McKerr to Anonymous

#20 Updated by eric sorenson almost 3 years ago

Triage-A-Thon: Duping #6583 to this one as this was here first.

#21 Updated by Charlie Sharpsteen over 1 year ago

  • Keywords set to customer

#23 Updated by Anonymous over 1 year ago

  • Assignee deleted (Anonymous)

Also available in: Atom PDF