Node.set, knife node show, and deep merging arrays


If a cookbook defines attributes such as:

default[:foo] = {
:bar => %w( one )

And in the recipe, ‘:foo’ is explicitly set:

node.set[:foo][:bar] = %w( two )

log “ is #{node[:foo][:bar]}” # Logs ‘two’

Then the node gets a ‘normal’ attribute of == [‘two’]

So this is not a deep merge of, but rather
an explicit ‘set’.

Which seems right, and that’s what it evaluates to in the
recipe and it’s templates.

The issue: ‘knife node show’ displays inconsistent values.

knife node show the-node --attrib foo --format json

# displays:


“foo”: {

“bar”: [“one”, “two”] # <- deep merge default+normal



knife node show the-node --attrib --format json

# displays:

{ “”: [“two”] } # the explicitly set value

Unless I’m missing something, this appears to be a bug.
‘knife node show’ with the --attrib option must display
the value of the given attribute as evaluated in the
recipe, should it not?