summaryrefslogtreecommitdiff
path: root/lib/leap_cli/commands
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2017-01-05 10:47:06 -0800
committerelijah <elijah@riseup.net>2017-01-05 10:47:06 -0800
commit5ba6924cd64322c4759acfa1c12873a871043170 (patch)
treec1d1c6694110596438d9ad6d2a731d914ee01981 /lib/leap_cli/commands
parent099eee57bcfcc7dc5ff0db48df266b0f30308bed (diff)
parentc0f489c4226c924fa1d96d12cba7eb5f63ccaf64 (diff)
Merge branch 'feature/node-disable'
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