summaryrefslogtreecommitdiff
path: root/lib/leap_cli/commands
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2016-12-21 11:06:48 -0800
committerelijah <elijah@riseup.net>2016-12-21 11:06:48 -0800
commitc0f489c4226c924fa1d96d12cba7eb5f63ccaf64 (patch)
tree0c56b92b262f3f7718cfc628644f2756f4caf1c9 /lib/leap_cli/commands
parent4116559c43b36cf69dc128769cbae857c53f094f (diff)
add command `leap node disable` and `leap node enable`
Diffstat (limited to 'lib/leap_cli/commands')
-rw-r--r--lib/leap_cli/commands/node.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/leap_cli/commands/node.rb b/lib/leap_cli/commands/node.rb
index 60540de9..9cde15bc 100644
--- a/lib/leap_cli/commands/node.rb
+++ b/lib/leap_cli/commands/node.rb
@@ -45,6 +45,23 @@ module LeapCli; module Commands
do_node_rm(global_options, options, args)
end
end
+
+ node.desc 'Mark a node as disabled.'
+ node.arg_name 'NAME'
+ node.command :disable do |cmd|
+ cmd.action do |global_options,options,args|
+ do_node_disable(global_options, options, args)
+ end
+ end
+
+ node.desc 'Mark a node as enabled.'
+ node.arg_name 'NAME'
+ node.command :enable do |cmd|
+ cmd.action do |global_options,options,args|
+ do_node_enable(global_options, options, args)
+ end
+ end
+
end
##
@@ -126,4 +143,14 @@ module LeapCli; module Commands
remove_node_facts(node.name)
end
+ def do_node_enable(global, options, args)
+ node = get_node_from_args(args, include_disabled: true)
+ node.update_json({}, remove: ["enabled"])
+ end
+
+ def do_node_disable(global, options, args)
+ node = get_node_from_args(args, include_disabled: true)
+ node.update_json("enabled" => false)
+ end
+
end; end