Sha256: b3e9e81715f52f32fcd824f4d06023642b2f43ac93eae484f484381560223c0d

Contents?: true

Size: 1.15 KB

Versions: 9

Compression:

Stored size: 1.15 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,
        'chef_packages' => chef_packages,
        'counters' => counters,
        'current_user' => current_user,
        'domain' => domain,
        'etc' => etc,
        'hostname' => hostname,
        'fqdn' => fqdn,
        'ipaddress' => ipaddress,
        'keys' => keys,
        'macaddress' => macaddress,
        'network' => network,
        'uptime' => uptime,
        'uptime_seconds' => uptime_seconds,
        'cpu' => cpu,
        'memory' => memory,
        'virtualization' => virtualization
      )

      puts JSON.pretty_generate(result)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
fauxhai-4.1.0 lib/fauxhai/runner.rb
fauxhai-4.0.2 lib/fauxhai/runner.rb
fauxhai-4.0.1 lib/fauxhai/runner.rb
fauxhai-4.0.0 lib/fauxhai/runner.rb
fauxhai-3.10.0 lib/fauxhai/runner.rb
fauxhai-3.9.0 lib/fauxhai/runner.rb
fauxhai-3.8.0 lib/fauxhai/runner.rb
fauxhai-3.7.0 lib/fauxhai/runner.rb
fauxhai-3.6.0 lib/fauxhai/runner.rb