diff options
author | elijah <elijah@riseup.net> | 2017-01-05 10:47:06 -0800 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2017-01-05 10:47:06 -0800 |
commit | 5ba6924cd64322c4759acfa1c12873a871043170 (patch) | |
tree | c1d1c6694110596438d9ad6d2a731d914ee01981 /lib/leap_cli/commands/node.rb | |
parent | 099eee57bcfcc7dc5ff0db48df266b0f30308bed (diff) | |
parent | c0f489c4226c924fa1d96d12cba7eb5f63ccaf64 (diff) |
Merge branch 'feature/node-disable'
Diffstat (limited to 'lib/leap_cli/commands/node.rb')
-rw-r--r-- | lib/leap_cli/commands/node.rb | 27 |
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 |