aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2013-05-27 16:46:55 -0700
committerelijah <elijah@riseup.net>2013-05-27 16:46:55 -0700
commit6bfb4551e79d2e3dfe71d6209ce3bda4e85646fd (patch)
treef42fd4018aafc781140dea02bcca733a15b85cce
parent41f5d1da28054f5bd208c8825fc552f038b764c8 (diff)
downloadleap_cli-6bfb4551e79d2e3dfe71d6209ce3bda4e85646fd.tar.gz
leap_cli-6bfb4551e79d2e3dfe71d6209ce3bda4e85646fd.tar.bz2
disabled nodes -- ensure the disabled nodes are also removed from the services and tags node lists.
-rw-r--r--lib/leap_cli/config/manager.rb36
1 files changed, 25 insertions, 11 deletions
diff --git a/lib/leap_cli/config/manager.rb b/lib/leap_cli/config/manager.rb
index dc74b6c..a88f7d0 100644
--- a/lib/leap_cli/config/manager.rb
+++ b/lib/leap_cli/config/manager.rb
@@ -47,18 +47,8 @@ module LeapCli
@nodes[name] = apply_inheritance(node)
end
- # remove disabled nodes
- @disabled_nodes = Config::ObjectList.new
unless options[:include_disabled]
- @nodes.select! do |name, node|
- if node.enabled
- true
- else
- log 2, :skipping, "disabled node #{name}."
- @disabled_nodes[name] = node
- false
- end
- end
+ remove_disabled_nodes
end
# validate
@@ -293,6 +283,30 @@ module LeapCli
return new_node
end
+ def remove_disabled_nodes
+ @disabled_nodes = Config::ObjectList.new
+ @nodes.select! do |name, node|
+ if node.enabled
+ true
+ else
+ log 2, :skipping, "disabled node #{name}."
+ @disabled_nodes[name] = node
+ if node['services']
+ node['services'].to_a.each do |node_service|
+ @services[node_service].node_list.delete(node.name)
+ end
+ end
+ if node['tags']
+ node['tags'].to_a.each do |node_tag|
+ @tags[node_tag].node_list.delete(node.name)
+ end
+ end
+ false
+ end
+ end
+ end
+
+
#
# returns a set of nodes corresponding to a single name, where name could be a node name, service name, or tag name.
#