diff options
author | elijah <elijah@riseup.net> | 2015-07-10 18:04:08 -0700 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2015-07-10 18:04:08 -0700 |
commit | ab406d6f9a8487b2ac837adc3eeae01788fb2a93 (patch) | |
tree | c2e748c8e219a01f7644453b7af265369ccb3d17 /lib/leap_cli/commands/facts.rb | |
parent | f528ccc241b88d49eb33bfc9b260a569d7651b48 (diff) |
improve `leap facts update`. closes bugs #7236 and #7237
Diffstat (limited to 'lib/leap_cli/commands/facts.rb')
-rw-r--r-- | lib/leap_cli/commands/facts.rb | 8 |
1 files changed, 4 insertions, 4 deletions
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| |