From 6dbb8af5eeb0f7bd0300feb3a564011be1f08d93 Mon Sep 17 00:00:00 2001 From: elijah Date: Mon, 29 Aug 2016 13:40:01 -0700 Subject: fix bug when nodes have bad tags --- lib/leap_cli/config/manager.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/leap_cli/config/manager.rb b/lib/leap_cli/config/manager.rb index b42f1ae0..e39334c8 100644 --- a/lib/leap_cli/config/manager.rb +++ b/lib/leap_cli/config/manager.rb @@ -324,8 +324,8 @@ module LeapCli node['tags'].each do |node_tag| tag = node_env.tags[node_tag] if tag.nil? - msg = 'in node "%s": the tag "%s" does not exist.' % [node['name'], node_tag] - log 0, :error, msg + msg = 'in node `%s`: the tag "%s" does not exist!' % [node['name'], node_tag] + LeapCli.log 0, :error, msg raise LeapCli::ConfigError.new(node, "error " + msg) if throw_exceptions else new_node.deep_merge!(tag) @@ -384,8 +384,11 @@ module LeapCli end if node['tags'] node['tags'].to_a.each do |node_tag| - env(node.environment).tags[node_tag].node_list.add(node.name, node) - env('_all_').tags[node_tag].node_list.add(node.name, node) + if env(node.environment).tags[node_tag] + # if tag exists + env(node.environment).tags[node_tag].node_list.add(node.name, node) + env('_all_').tags[node_tag].node_list.add(node.name, node) + end end end if node.name == 'default' || environment_names.include?(node.name) -- cgit v1.2.3