lib/onering/cli/reporter.rb in onering-client-0.2.1 vs lib/onering/cli/reporter.rb in onering-client-0.2.3
- old
+ new
@@ -1,8 +1,8 @@
module Onering
module CLI
- module Report
+ class Report < Plugin
DEFAULT_CACHE_MAXAGE=600
def self.configure(global={})
@api = Onering::CLI.connect(global.merge({
@@ -120,11 +120,11 @@
break unless rv.nil?
end
# if we're still nil by this point, use the fallback value
rv = report.get(args[0], args[1]) if rv.nil?
-
+
# attempt to get the value remotely if not found locally
if rv.nil? and not @opts[:local]
hid = Onering::Util.fact(:hardwareid)
if not hid.nil?
@@ -152,24 +152,9 @@
def self._report(options={})
begin
Onering::Logger.debug("Gathering local data for report", "Onering::CLI::Report")
Onering::Logger.fatal("Reporter not configured. This is a bug", "Onering::CLI::Report") if @_reporter.nil?
report = @_reporter.report(options).stringify_keys()
-
- # pull report overrides from the config file
- Onering::Config.get('reporter.fields',{}).each do |key, value|
- Onering::Logger.debug("Override value #{key} from config file", "Onering::CLI::Report")
-
- if value.is_a?(Hash)
- value.coalesce(key, nil, '.').each do |k,v|
- v = nil if ['null', '', '-'].include?(v.to_s.strip.chomp)
- report = report.set(k, v)
- end
- else
- value = nil if ['null', '', '-'].include?(value.to_s.strip.chomp)
- report = report.set(key, value)
- end
- end
return report
rescue Timeout::Error
Onering::Logger.fatal!("Report took too long to generate, exiting...", "Onering::CLI::Report")
end
\ No newline at end of file