Sha256: 032b77b2002697f16fac924e0a93e9d71c3b2565dc9d8d48724cfc1ec7426885

Contents?: true

Size: 1.22 KB

Versions: 20

Compression:

Stored size: 1.22 KB

Contents

require 'ohai'
require 'ohai/plugins/chef'

module Fauxhai
  class Runner
    def initialize(args)
      @system = Ohai::System.new
      @system.all_plugins

      case @system.data['platform']
      when 'windows', :windows
        require 'fauxhai/runner/windows'
        self.singleton_class.send :include, ::Fauxhai::Runner::Windows
      else
        require 'fauxhai/runner/default'
        self.singleton_class.send :include, ::Fauxhai::Runner::Default
      end

      result = @system.data.dup.delete_if { |k, v| !whitelist_attributes.include?(k) }.merge(
        'languages' => languages,
        'counters' => counters,
        'current_user' => current_user,
        'domain' => domain,
        'hostname' => hostname,
        'machinename' => hostname,
        'fqdn' => fqdn,
        'ipaddress' => ipaddress,
        'keys' => keys,
        'macaddress' => macaddress,
        'network' => network,
        'uptime' => uptime,
        'uptime_seconds' => uptime_seconds,
        'idle' => uptime,
        'idletime_seconds' => uptime_seconds,
        'cpu' => cpu,
        'memory' => memory,
        'virtualization' => virtualization,
        'time' => time
      )

      puts JSON.pretty_generate(result.sort.to_h)
    end
  end
end

Version data entries

20 entries across 20 versions & 3 rubygems

Version Path
fauxhai-ng-slim-7.5.1 lib/fauxhai/runner.rb
fauxhai-ng-7.5.1 lib/fauxhai/runner.rb
fauxhai-ng-7.5.0 lib/fauxhai/runner.rb
fauxhai-7.4.0 lib/fauxhai/runner.rb
fauxhai-7.3.0 lib/fauxhai/runner.rb
fauxhai-7.2.0 lib/fauxhai/runner.rb
fauxhai-7.1.0 lib/fauxhai/runner.rb
fauxhai-7.0.0 lib/fauxhai/runner.rb
fauxhai-6.11.0 lib/fauxhai/runner.rb
fauxhai-6.10.0 lib/fauxhai/runner.rb
fauxhai-6.9.1 lib/fauxhai/runner.rb
fauxhai-6.9.0 lib/fauxhai/runner.rb
fauxhai-6.8.0 lib/fauxhai/runner.rb
fauxhai-6.7.0 lib/fauxhai/runner.rb
fauxhai-6.6.0 lib/fauxhai/runner.rb
fauxhai-6.5.0 lib/fauxhai/runner.rb
fauxhai-6.4.0 lib/fauxhai/runner.rb
fauxhai-6.3.0 lib/fauxhai/runner.rb
fauxhai-6.2.0 lib/fauxhai/runner.rb
fauxhai-6.1.0 lib/fauxhai/runner.rb