Created
November 18, 2011 12:11
-
-
Save llaurent/1376294 to your computer and use it in GitHub Desktop.
deep merge and !merge:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default[:test1] = { | |
:t1 => [ "un", "deux", "trois" ], | |
:t2 => [ "un", "deux", "trois" ], | |
:t3 => [ "un", "deux", "trois" ], | |
:t4 => [ "un", "deux", "trois" ], | |
:t5 => [ "un", "deux", "trois" ] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Chef::Log.info("BLA1: #{node[:test1][:t1].inspect}") | |
Chef::Log.info("BLA2: #{node[:test1][:t2].inspect}") | |
Chef::Log.info("BLA3: #{node[:test1][:t3].inspect}") | |
Chef::Log.info("BLA4: #{node[:test1][:t4].inspect}") | |
Chef::Log.info("BLA5: #{node[:test1][:t5].inspect}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Fri, 18 Nov 2011 13:09:13 +0100] INFO: BLA1: ["un", "deux", "trois"] | |
[Fri, 18 Nov 2011 13:09:13 +0100] INFO: BLA2: ["un", "deux", "trois"] | |
[Fri, 18 Nov 2011 13:09:13 +0100] INFO: BLA3: ["un", "deux", "trois"] | |
[Fri, 18 Nov 2011 13:09:13 +0100] INFO: BLA4: ["un", "deux", "trois"] | |
[Fri, 18 Nov 2011 13:09:13 +0100] INFO: BLA5: ["un", "deux", "trois", "quatre", "cinq", "six"] | |
looking at http://wiki.opscode.com/display/chef/Deep+Merge i would have expected these results instead : | |
:t1 => [ "un", "trois" ] | |
:t2 => [ ] | |
:t3 => [ "deux", "trois" ] | |
:t4 => [ "quatre", "cinq", "six" ] | |
:t5 looks ok to me :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name "test1" | |
description "test" | |
default_attributes "test1" => { | |
:t1 => [ "!merge:deux" ], | |
:t2 => [ "!merge:" ], | |
:t3 => [ "!merge:", "deux", "trois" ], | |
:t4 => [ "!merge:", "quatre", "cinq", "six" ], | |
:t5 => [ "quatre", "cinq", "six" ] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
doesn't change a thing if the attributes are set like this in the cookbook:
default[:test1][:t1] = [ "un", "deux", "trois" ]
default[:test1][:t2] = [ "un", "deux", "trois" ]
default[:test1][:t3] = [ "un", "deux", "trois" ]
default[:test1][:t4] = [ "un", "deux", "trois" ]
default[:test1][:t5] = [ "un", "deux", "trois" ]
as stated here : http://tickets.opscode.com/browse/CHEF-2278?focusedCommentId=19092&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-19092