lib/fauxhai/runner/default.rb in fauxhai-4.1.0 vs lib/fauxhai/runner/default.rb in fauxhai-5.0.0
- old
+ new
@@ -3,56 +3,56 @@
module Default
def bin_dir
'/usr/local/bin'
end
- def chef_packages
- return {} if @system.data['chef_packages'].nil?
-
- chef_version = @system.data['chef_packages']['chef']['version']
- ohai_version = @system.data['chef_packages']['ohai']['version']
-
- {
- 'chef' => {
- 'version' => chef_version,
- 'chef_root' => ['/opt/chef/embedded/lib/ruby/gems/2.1.0/gems', "chef-#{chef_version}", 'lib'].join('/')
- },
- 'ohai' => {
- 'version' => ohai_version,
- 'ohai_root' => ['/opt/chef/embedded/lib/ruby/gems/2.1.0/gems', "ohai-#{ohai_version}", 'lib', 'ohai'].join('/')
- }
- }
- end
-
def counters
{
'network' => {
'interfaces' => {
- 'eth0' => {
+ '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',
+ 'bytes' => 0,
+ 'packets' => 0,
+ 'errors' => 0,
'drop' => 0,
'overrun' => 0,
'frame' => 0,
'compressed' => 0,
- 'multicast' => 0
+ 'multicast' => 0,
},
'tx' => {
- 'bytes' => '342',
- 'packets' => '0',
- 'errors' => '0',
+ 'bytes' => 0,
+ 'packets' => 0,
+ 'errors' => 0,
'drop' => 0,
'overrun' => 0,
- 'collisions' => '0',
+ 'collisions' => 0,
'carrier' => 0,
- 'compressed' => 0
- }
- }
- }
- }
+ 'compressed' => 0,
+ },
+ },
+ },
+ },
}
end
def current_user
'fauxhai'
@@ -61,11 +61,20 @@
def default_gateway
'10.0.0.1'
end
def default_interface
- 'eth0'
+ case @system.data['platform_family']
+ when 'mac_os_x'
+ 'en0'
+ when /bsd/
+ 'em0'
+ when 'arch', 'fedora'
+ 'enp0s3'
+ else
+ 'eth0'
+ end
end
def domain
'local'
end
@@ -76,21 +85,21 @@
'fauxhai' => {
'dir' => '/home/fauxhai',
'gid' => 0,
'uid' => 0,
'shell' => '/bin/bash',
- 'gecos' => 'Fauxhai'
- }
+ 'gecos' => 'Fauxhai',
+ },
},
'group' => {
'fauxhai' => {
'gid' => 0,
'members' => [
- 'fauxhai'
- ]
- }
- }
+ 'fauxhai',
+ ],
+ },
+ },
}
end
def fqdn
'fauxhai.local'
@@ -116,75 +125,119 @@
'fe80:0:0:0:0:0:a00:2'
end
def keys
{
- 'ssh' => ssh
+ 'ssh' => ssh,
}
end
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']
+ 'powershell' => @system.data['languages']['powershell'],
}
end
def macaddress
'11:11:11:11:11:11'
end
def network
{
- 'default_gateway' => default_gateway,
- 'default_interface' => default_interface,
- 'settings' => {},
'interfaces' => {
- "#{default_interface}" => {
+ 'lo' => {
+ 'mtu' => '65536',
+ 'flags' => %w(LOOPBACK UP LOWER_UP),
+ 'encapsulation' => 'Loopback',
'addresses' => {
- "#{ipaddress}" => {
- 'broadcast' => '10.0.0.255',
+ '127.0.0.1' => {
'family' => 'inet',
- 'netmask' => '255.255.255.0',
+ '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',
- 'scope' => 'Global'
- }
+ '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'
+ '10.0.0.1' => 'fe:ff:ff:ff:ff:ff',
},
- 'encapsulation' => 'Ethernet',
- 'flags' => %w(BROADCAST MULTICAST UP LOWER_UP),
- 'mtu' => '1500',
- 'number' => '0',
'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',
+ },
],
- 'state' => 'up',
- 'type' => 'eth'
- }
- }
+ 'ring_params' => {},
+ },
+ },
+ 'default_interface' => default_interface,
+ 'default_gateway' => default_gateway,
}
end
def ruby_bin
'/usr/local/bin/ruby'
end
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
+ '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
def uptime
'30 days 15 hours 07 minutes 30 seconds'
@@ -196,45 +249,58 @@
def cpu
{
'real' => 1,
'total' => 1,
- 'cores' => 1
+ 'cores' => 1,
}
end
def memory
{
- 'total' => '1048576kB'
+ 'total' => '1048576kB',
}
end
def virtualization
{
- 'systems' => {}
+ 'systems' => {},
}
end
+ def time
+ {
+ 'timezone' => 'GMT',
+ }
+ end
+
# 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
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
- init_package
- root_group)
+ root_group
+ shard_seed
+ shells
+ )
end
end
end
-end
\ No newline at end of file
+end