Module: Fauxhai::Runner::Default
- Included in:
- Windows
- Defined in:
- lib/fauxhai/runner/default.rb
Instance Method Summary collapse
- #bin_dir ⇒ Object
- #counters ⇒ Object
- #cpu ⇒ Object
- #current_user ⇒ Object
- #default_gateway ⇒ Object
- #default_interface ⇒ Object
- #domain ⇒ Object
- #fqdn ⇒ Object
- #gem_bin ⇒ Object
- #gems_dir ⇒ Object
- #hostname ⇒ Object
- #ip6address ⇒ Object
- #ipaddress ⇒ Object
- #keys ⇒ Object
- #languages ⇒ Object
- #macaddress ⇒ Object
- #memory ⇒ Object
- #network ⇒ Object
- #ruby_bin ⇒ Object
- #ssh ⇒ Object
- #time ⇒ Object
- #uptime ⇒ Object
- #uptime_seconds ⇒ Object
- #virtualization ⇒ Object
-
#whitelist_attributes ⇒ Array
Whitelist attributes are attributes that we actually want from the node.
Instance Method Details
#bin_dir ⇒ Object
4 5 6 |
# File 'lib/fauxhai/runner/default.rb', line 4 def bin_dir "/usr/local/bin" end |
#counters ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# 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 ⇒ Object
228 229 230 231 232 233 234 |
# File 'lib/fauxhai/runner/default.rb', line 228 def cpu { "real" => 1, "total" => 1, "cores" => 1, } end |
#current_user ⇒ Object
57 58 59 |
# File 'lib/fauxhai/runner/default.rb', line 57 def current_user "fauxhai" end |
#default_gateway ⇒ Object
61 62 63 |
# File 'lib/fauxhai/runner/default.rb', line 61 def default_gateway "10.0.0.1" end |
#default_interface ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 |
# 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 ⇒ Object
78 79 80 |
# File 'lib/fauxhai/runner/default.rb', line 78 def domain "local" end |
#fqdn ⇒ Object
82 83 84 |
# File 'lib/fauxhai/runner/default.rb', line 82 def fqdn "fauxhai.local" end |
#gem_bin ⇒ Object
86 87 88 |
# File 'lib/fauxhai/runner/default.rb', line 86 def gem_bin "/usr/local/bin/gem" end |
#gems_dir ⇒ Object
90 91 92 |
# File 'lib/fauxhai/runner/default.rb', line 90 def gems_dir "/usr/local/gems" end |
#hostname ⇒ Object
94 95 96 |
# File 'lib/fauxhai/runner/default.rb', line 94 def hostname "Fauxhai" end |
#ip6address ⇒ Object
102 103 104 |
# File 'lib/fauxhai/runner/default.rb', line 102 def ip6address "fe80:0:0:0:0:0:a00:2" end |
#ipaddress ⇒ Object
98 99 100 |
# File 'lib/fauxhai/runner/default.rb', line 98 def ipaddress "10.0.0.2" end |
#keys ⇒ Object
106 107 108 109 110 |
# File 'lib/fauxhai/runner/default.rb', line 106 def keys { "ssh" => ssh, } end |
#languages ⇒ Object
112 113 114 115 116 117 118 119 120 |
# 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 ⇒ Object
122 123 124 |
# File 'lib/fauxhai/runner/default.rb', line 122 def macaddress "11:11:11:11:11:11" end |
#memory ⇒ Object
236 237 238 239 240 |
# File 'lib/fauxhai/runner/default.rb', line 236 def memory { "total" => "1048576kB", } end |
#network ⇒ Object
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
# 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 ⇒ Object
209 210 211 |
# File 'lib/fauxhai/runner/default.rb', line 209 def ruby_bin "/usr/local/bin/ruby" end |
#ssh ⇒ Object
213 214 215 216 217 218 |
# 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 ⇒ Object
248 249 250 251 252 |
# File 'lib/fauxhai/runner/default.rb', line 248 def time { "timezone" => "GMT", } end |
#uptime ⇒ Object
220 221 222 |
# File 'lib/fauxhai/runner/default.rb', line 220 def uptime "30 days 15 hours 07 minutes 30 seconds" end |
#uptime_seconds ⇒ Object
224 225 226 |
# File 'lib/fauxhai/runner/default.rb', line 224 def uptime_seconds 2646450 end |
#virtualization ⇒ Object
242 243 244 245 246 |
# File 'lib/fauxhai/runner/default.rb', line 242 def virtualization { "systems" => {}, } end |
#whitelist_attributes ⇒ Array
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.
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
# 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 |