unpack_arrays setting

Finally, there's the unpack_arrays setting. Let us change the data for our node again to look as follows, while leaving the common data the same:

# mynode.myorg.net.yaml classification:   classes:     - --paessler,nagios     - webserver 

The unpack_arrays setting takes each string, splits it according to the , delimiter, creating an array of, in our example, [“–-paessler”, “nagios”], and then merging it; in our example knocking out the paessler value, since it was indicated with the knockout_prefix as follows:

lookup({   'name'  => 'classification',   'merge' => {     'strategy'        => 'deep',     'knockout_prefix' => '--',     unpack_arrays     =>’,’,   }, })

Get Mastering Puppet 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.