module Fauxhai::Runner::Default

Public Instance Methods

bin_dir() click to toggle source
# File lib/fauxhai/runner/default.rb, line 4
def bin_dir
  "/usr/local/bin"
end
counters() click to toggle source
# File lib/fauxhai/runner/default.rb, line 8
def counters
  {
    "network" => {
      "interfaces" => {
        "lo" => {
          "tx" => {
            "queuelen" => "1",
            "bytes" =>  0,
            "packets" =>  0,
            "errors" =>  0,
            "drop" =>  0,
            "carrier" => 0,
            "collisions" => 0,
          },
          "rx" =>  {
            "bytes" => 0,
            "packets" => 0,
            "errors" => 0,
            "drop" => 0,
            "overrun" => 0,
          },
        },
        default_interface.to_s => {
          "rx" => {
            "bytes" => 0,
            "packets" => 0,
            "errors" => 0,
            "drop" => 0,
            "overrun" => 0,
            "frame" => 0,
            "compressed" => 0,
            "multicast" => 0,
          },
          "tx" => {
            "bytes" => 0,
            "packets" => 0,
            "errors" => 0,
            "drop" => 0,
            "overrun" => 0,
            "collisions" => 0,
            "carrier" => 0,
            "compressed" => 0,
          },
        },
      },
    },
  }
end
cpu() click to toggle source
# File lib/fauxhai/runner/default.rb, line 228
def cpu
  {
    "real" => 1,
    "total" => 1,
    "cores" => 1,
  }
end
current_user() click to toggle source
# File lib/fauxhai/runner/default.rb, line 57
def current_user
  "fauxhai"
end
default_gateway() click to toggle source
# File lib/fauxhai/runner/default.rb, line 61
def default_gateway
  "10.0.0.1"
end
default_interface() click to toggle source
# File lib/fauxhai/runner/default.rb, line 65
def default_interface
  case @system.data["platform_family"]
  when "mac_os_x"
    "en0"
  when /bsd/
    "em0"
  when "arch", "fedora"
    "enp0s3"
  else
    "eth0"
  end
end
domain() click to toggle source
# File lib/fauxhai/runner/default.rb, line 78
def domain
  "local"
end
fqdn() click to toggle source
# File lib/fauxhai/runner/default.rb, line 82
def fqdn
  "fauxhai.local"
end
gem_bin() click to toggle source
# File lib/fauxhai/runner/default.rb, line 86
def gem_bin
  "/usr/local/bin/gem"
end
gems_dir() click to toggle source
# File lib/fauxhai/runner/default.rb, line 90
def gems_dir
  "/usr/local/gems"
end
hostname() click to toggle source
# File lib/fauxhai/runner/default.rb, line 94
def hostname
  "Fauxhai"
end
ip6address() click to toggle source
# File lib/fauxhai/runner/default.rb, line 102
def ip6address
  "fe80:0:0:0:0:0:a00:2"
end
ipaddress() click to toggle source
# File lib/fauxhai/runner/default.rb, line 98
def ipaddress
  "10.0.0.2"
end
keys() click to toggle source
# File lib/fauxhai/runner/default.rb, line 106
def keys
  {
    "ssh" => ssh,
  }
end
languages() click to toggle source
# File lib/fauxhai/runner/default.rb, line 112
def languages
  {
    "ruby" => @system.data["languages"]["ruby"].merge("bin_dir" => bin_dir,
                                                      "gem_bin" => gem_bin,
                                                      "gems_dir" => gems_dir,
                                                      "ruby_bin" => ruby_bin),
    "powershell" => @system.data["languages"]["powershell"],
  }
end
macaddress() click to toggle source
# File lib/fauxhai/runner/default.rb, line 122
def macaddress
  "11:11:11:11:11:11"
end
memory() click to toggle source
# File lib/fauxhai/runner/default.rb, line 236
def memory
  {
    "total" => "1048576kB",
  }
end
network() click to toggle source
# File lib/fauxhai/runner/default.rb, line 126
def network
  {
    "interfaces" => {
      "lo" => {
        "mtu" => "65536",
        "flags" => %w{LOOPBACK UP LOWER_UP},
        "encapsulation" => "Loopback",
        "addresses" => {
          "127.0.0.1" => {
            "family" => "inet",
            "prefixlen" => "8",
            "netmask" => "255.0.0.0",
            "scope" => "Node",
            "ip_scope" => "LOOPBACK",
          },
          "::1" => {
            "family" => "inet6",
            "prefixlen" => "128",
            "scope" => "Node",
            "tags" => [],
            "ip_scope" => "LINK LOCAL LOOPBACK",
          },
        },
        "state" => "unknown",
      },
      default_interface.to_s => {
        "type" => default_interface.chop,
        "number" => "0",
        "mtu" => "1500",
        "flags" => %w{BROADCAST MULTICAST UP LOWER_UP},
        "encapsulation" => "Ethernet",
        "addresses" => {
          macaddress.to_s => {
            "family" => "lladdr",
          },
          ipaddress.to_s => {
            "family" => "inet",
            "prefixlen" => "24",
            "netmask" => "255.255.255.0",
            "broadcast" => "10.0.0.255",
            "scope" => "Global",
            "ip_scope" => "RFC1918 PRIVATE",
          },
          "fe80::11:1111:1111:1111" => {
            "family" => "inet6",
            "prefixlen" => "64",
            "scope" => "Link",
            "tags" => [],
            "ip_scope" => "LINK LOCAL UNICAST",
          },
        },
        "state" => "up",
        "arp" => {
          "10.0.0.1" => "fe:ff:ff:ff:ff:ff",
        },
        "routes" => [
          {
            "destination" => "default",
            "family" => "inet",
            "via" => default_gateway,
          },
          {
            "destination" => "10.0.0.0/24",
            "family" => "inet",
            "scope" => "link",
            "proto" => "kernel",
            "src" => ipaddress,
          },
          {
            "destination" => "fe80::/64",
            "family" => "inet6",
            "metric" => "256",
            "proto" => "kernel",
          },
        ],
        "ring_params" => {},
      },
    },
    "default_interface" => default_interface,
    "default_gateway" => default_gateway,
  }
end
ruby_bin() click to toggle source
# File lib/fauxhai/runner/default.rb, line 209
def ruby_bin
  "/usr/local/bin/ruby"
end
ssh() click to toggle source
# File lib/fauxhai/runner/default.rb, line 213
def ssh
  {
    "host_dsa_public" => File.read(File.join(Fauxhai.root, "lib", "fauxhai", "keys", "id_dsa.pub")).strip,
    "host_rsa_public" => File.read(File.join(Fauxhai.root, "lib", "fauxhai", "keys", "id_rsa.pub")).strip,
  }
end
time() click to toggle source
# File lib/fauxhai/runner/default.rb, line 248
def time
  {
    "timezone" => "GMT",
  }
end
uptime() click to toggle source
# File lib/fauxhai/runner/default.rb, line 220
def uptime
  "30 days 15 hours 07 minutes 30 seconds"
end
uptime_seconds() click to toggle source
# File lib/fauxhai/runner/default.rb, line 224
def uptime_seconds
  2646450
end
virtualization() click to toggle source
# File lib/fauxhai/runner/default.rb, line 242
def virtualization
  {
    "systems" => {},
  }
end
whitelist_attributes() click to toggle source

Whitelist attributes are attributes that we actually want from the node. Other attributes are either ignored or overridden, but we ensure these are returned with the command.

@return [Array] - the key of whitelisted attributes

# File lib/fauxhai/runner/default.rb, line 258
def whitelist_attributes
  %w{
    block_device
    chef_packages
    command
    dmi
    filesystem
    fips
    init_package
    kernel
    lsb
    ohai_time
    os
    os_version
    packages
    platform
    platform_version
    platform_build
    platform_family
    root_group
    shard_seed
    shells
  }
end