lib/chef/knife/topo_create.rb in knife-topo-2.0.3 vs lib/chef/knife/topo_create.rb in knife-topo-2.0.4

- old
+ new

@@ -48,20 +48,20 @@ ) # Make called command options available orig_opts = KnifeTopo::TopoCreate.options upload_opts = Chef::Knife::CookbookUpload.options - merged_opts = (KnifeTopo::TopoBootstrap.options).merge(upload_opts) + merged_opts = KnifeTopo::TopoBootstrap.options.merge(upload_opts) self.options = merged_opts.merge(orig_opts) include KnifeTopo::CommandHelper include KnifeTopo::NodeUpdateHelper include KnifeTopo::Loader def initialize(args) super - @args = args + @args = args end def bootstrap_msgs msgs = super.dup msgs[:existed] = 'Updated but did not bootstrap %{num} existing nodes '\ @@ -114,12 +114,13 @@ confirm_and_update_topo end def update_nodes nodes = processor.generate_nodes + merge = @topo.merge_attrs nodes.each do |node_data| - bootstrap_or_update_node(node_data) + bootstrap_or_update_node(node_data, merge) end end def confirm_and_update_topo version = @topo.topo_version @@ -128,19 +129,17 @@ "update it#{to_version_str if version}" ui.confirm(msg, true, false) @topo.save end - def bootstrap_or_update_node(node_data) + def bootstrap_or_update_node(node_data, merge) node_name = node_data['name'] if @bootstrap - update_node(node_data) unless node_bootstrap(node_data) + update_node(node_data, merge) unless node_bootstrap(node_data) + elsif update_node(node_data, merge) + @results[:existed] << node_name else - if update_node(node_data) - @results[:existed] << node_name - else - @results[:skipped] << node_name - end + @results[:skipped] << node_name end end def upload_artifacts processor.upload_artifacts('cmd' => self, 'cmd_args' => @args)