Feature #3534

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

Added by Stefan Goethals about 2 years ago. Updated 22 days ago.

Status:Needs Decision Start date:04/12/2010
Priority:Normal Due date:
Assignee:Daniel Pittman % Done:

0%

Category:-
Target version:-
Keywords: Affected URL:
Branch: Affected Dashboard version:
Votes: 14

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

Updated by Stefan Goethals almost 2 years ago

  • Status changed from Unreviewed to Closed

Using the split() function works fine.

Updated by Dan Bode almost 2 years ago

  • Status changed from Closed to Re-opened

we need real support for arrays to support proper overrides:

See #4052 for an example.

Updated by David Schmitt almost 2 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

Updated by Rein Henrichs almost 2 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.

Updated by David Schmitt almost 2 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.

Updated by Ken Barber almost 2 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 :–).

Updated by Luke Kanies almost 2 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.

Updated by Marc-Olivier Barre over 1 year ago

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

Updated by Stefan Goethals over 1 year 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
.....

}

Updated by James Turnbull about 1 year ago

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

Updated by James Turnbull about 1 year ago

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

Updated by Dan Bode about 1 year 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

Updated by James Turnbull about 1 year ago

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

Note Support URL and link to #4052

Updated by Nigel Kersten 12 months ago

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

Updated by James Turnbull 11 months ago

  • Target version deleted (142)

Updated by Dan Bode 9 months ago

  • Tracker changed from Bug to Feature

Updated by Daniel Pittman 8 months 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.

Updated by James Turnbull 7 months 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.

Updated by Daniel Pittman 5 months ago

  • Assignee changed from Jason McKerr to Daniel Pittman

Updated by eric sorenson 4 months ago

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

Also available in: Atom PDF