From ab406d6f9a8487b2ac837adc3eeae01788fb2a93 Mon Sep 17 00:00:00 2001 From: elijah Date: Fri, 10 Jul 2015 18:04:08 -0700 Subject: improve `leap facts update`. closes bugs #7236 and #7237 --- lib/leap_cli/commands/deploy.rb | 2 +- lib/leap_cli/commands/facts.rb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/leap_cli/commands') diff --git a/lib/leap_cli/commands/deploy.rb b/lib/leap_cli/commands/deploy.rb index f5c47fe..c2a70af 100644 --- a/lib/leap_cli/commands/deploy.rb +++ b/lib/leap_cli/commands/deploy.rb @@ -34,7 +34,7 @@ module LeapCli init_submodules end - nodes = manager.filter!(args) + nodes = manager.filter!(args, :disabled => false) if nodes.size > 1 say "Deploying to these nodes: #{nodes.keys.join(', ')}" if !global[:yes] && !agree("Continue? ") diff --git a/lib/leap_cli/commands/facts.rb b/lib/leap_cli/commands/facts.rb index 65eda61..11329cc 100644 --- a/lib/leap_cli/commands/facts.rb +++ b/lib/leap_cli/commands/facts.rb @@ -49,7 +49,7 @@ module LeapCli; module Commands if overwrite || content.nil? || content.empty? old_facts = {} else - old_facts = JSON.parse(content) + old_facts = manager.facts end facts = old_facts.merge(new_facts) facts.each do |name, value| @@ -57,7 +57,7 @@ module LeapCli; module Commands if value == "" value = nil else - value = JSON.parse(value) + value = JSON.parse(value) rescue JSON::ParserError end end if value.is_a? Hash @@ -69,7 +69,7 @@ module LeapCli; module Commands value.nil? || value.empty? end if facts.empty? - nil + "{}\n" else JSON.sorted_generate(facts) + "\n" end @@ -79,7 +79,7 @@ module LeapCli; module Commands private def update_facts(global_options, options, args) - nodes = manager.filter(args, :local => false) + nodes = manager.filter(args, :local => false, :disabled => false) new_facts = {} ssh_connect(nodes) do |ssh| ssh.leap.run_with_progress(facter_cmd) do |response| -- cgit v1.2.3