fauxhai-ng 8.2.0 → 8.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/fauxhai +8 -8
- data/lib/.DS_Store +0 -0
- data/lib/fauxhai.rb +5 -5
- data/lib/fauxhai/.DS_Store +0 -0
- data/lib/fauxhai/fetcher.rb +9 -8
- data/lib/fauxhai/mocker.rb +13 -13
- data/lib/fauxhai/platforms/.DS_Store +0 -0
- data/lib/fauxhai/platforms/amazon/2.json +3128 -3132
- data/lib/fauxhai/platforms/amazon/2016.03.json +2323 -2333
- data/lib/fauxhai/platforms/amazon/2016.09.json +2356 -2366
- data/lib/fauxhai/platforms/amazon/2017.03.json +2329 -2339
- data/lib/fauxhai/platforms/amazon/2017.09.json +2370 -2380
- data/lib/fauxhai/platforms/amazon/2018.03.json +2403 -2413
- data/lib/fauxhai/platforms/centos/6.9.json +1 -0
- data/lib/fauxhai/platforms/centos/7.7.1908.json +34 -34
- data/lib/fauxhai/platforms/centos/8.json +1153 -841
- data/lib/fauxhai/platforms/debian/10.json +31 -31
- data/lib/fauxhai/platforms/debian/8.11.json +1 -0
- data/lib/fauxhai/platforms/debian/9.11.json +33 -35
- data/lib/fauxhai/platforms/debian/{8.10.json → 9.12.json} +984 -1645
- data/lib/fauxhai/platforms/debian/9.8.json +36 -37
- data/lib/fauxhai/platforms/debian/9.9.json +37 -38
- data/lib/fauxhai/platforms/opensuse/15.0.json +1 -0
- data/lib/fauxhai/platforms/opensuse/15.1.json +40 -42
- data/lib/fauxhai/platforms/oracle/6.10.json +19 -19
- data/lib/fauxhai/platforms/oracle/6.9.json +1 -0
- data/lib/fauxhai/platforms/oracle/7.5.json +481 -497
- data/lib/fauxhai/platforms/suse/12.3.json +38 -40
- data/lib/fauxhai/platforms/suse/12.4.json +40 -42
- data/lib/fauxhai/platforms/suse/12.5.json +41 -40
- data/lib/fauxhai/platforms/suse/15.json +996 -998
- data/lib/fauxhai/platforms/ubuntu/.DS_Store +0 -0
- data/lib/fauxhai/platforms/ubuntu/16.04.json +2038 -1980
- data/lib/fauxhai/platforms/ubuntu/18.04.json +2098 -2110
- data/lib/fauxhai/platforms/ubuntu/20.04.json +2353 -2097
- data/lib/fauxhai/runner.rb +27 -27
- data/lib/fauxhai/runner/default.rb +128 -128
- data/lib/fauxhai/runner/windows.rb +77 -77
- data/lib/fauxhai/version.rb +1 -1
- metadata +6 -7
- data/lib/fauxhai/platforms/debian/8.9.json +0 -3614
data/lib/fauxhai/runner.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "ohai" unless defined?(Ohai::System)
|
2
|
+
require "ohai/plugins/chef"
|
3
3
|
|
4
4
|
module Fauxhai
|
5
5
|
class Runner
|
@@ -7,35 +7,35 @@ module Fauxhai
|
|
7
7
|
@system = Ohai::System.new
|
8
8
|
@system.all_plugins
|
9
9
|
|
10
|
-
case @system.data[
|
11
|
-
when
|
12
|
-
require_relative
|
13
|
-
|
10
|
+
case @system.data["platform"]
|
11
|
+
when "windows", :windows
|
12
|
+
require_relative "runner/windows"
|
13
|
+
singleton_class.send :include, ::Fauxhai::Runner::Windows
|
14
14
|
else
|
15
|
-
require_relative
|
16
|
-
|
15
|
+
require_relative "runner/default"
|
16
|
+
singleton_class.send :include, ::Fauxhai::Runner::Default
|
17
17
|
end
|
18
18
|
|
19
19
|
result = @system.data.dup.delete_if { |k, v| !whitelist_attributes.include?(k) }.merge(
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
20
|
+
"languages" => languages,
|
21
|
+
"counters" => counters,
|
22
|
+
"current_user" => current_user,
|
23
|
+
"domain" => domain,
|
24
|
+
"hostname" => hostname,
|
25
|
+
"machinename" => hostname,
|
26
|
+
"fqdn" => fqdn,
|
27
|
+
"ipaddress" => ipaddress,
|
28
|
+
"keys" => keys,
|
29
|
+
"macaddress" => macaddress,
|
30
|
+
"network" => network,
|
31
|
+
"uptime" => uptime,
|
32
|
+
"uptime_seconds" => uptime_seconds,
|
33
|
+
"idle" => uptime,
|
34
|
+
"idletime_seconds" => uptime_seconds,
|
35
|
+
"cpu" => cpu,
|
36
|
+
"memory" => memory,
|
37
|
+
"virtualization" => virtualization,
|
38
|
+
"time" => time
|
39
39
|
)
|
40
40
|
|
41
41
|
puts JSON.pretty_generate(result.sort.to_h)
|
@@ -2,51 +2,51 @@ module Fauxhai
|
|
2
2
|
class Runner
|
3
3
|
module Default
|
4
4
|
def bin_dir
|
5
|
-
|
5
|
+
"/usr/local/bin"
|
6
6
|
end
|
7
7
|
|
8
8
|
def counters
|
9
9
|
{
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
10
|
+
"network" => {
|
11
|
+
"interfaces" => {
|
12
|
+
"lo" => {
|
13
|
+
"tx" => {
|
14
|
+
"queuelen" => "1",
|
15
|
+
"bytes" => 0,
|
16
|
+
"packets" => 0,
|
17
|
+
"errors" => 0,
|
18
|
+
"drop" => 0,
|
19
|
+
"carrier" => 0,
|
20
|
+
"collisions" => 0,
|
21
21
|
},
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
22
|
+
"rx" => {
|
23
|
+
"bytes" => 0,
|
24
|
+
"packets" => 0,
|
25
|
+
"errors" => 0,
|
26
|
+
"drop" => 0,
|
27
|
+
"overrun" => 0,
|
28
28
|
},
|
29
29
|
},
|
30
30
|
default_interface.to_s => {
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
31
|
+
"rx" => {
|
32
|
+
"bytes" => 0,
|
33
|
+
"packets" => 0,
|
34
|
+
"errors" => 0,
|
35
|
+
"drop" => 0,
|
36
|
+
"overrun" => 0,
|
37
|
+
"frame" => 0,
|
38
|
+
"compressed" => 0,
|
39
|
+
"multicast" => 0,
|
40
40
|
},
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
41
|
+
"tx" => {
|
42
|
+
"bytes" => 0,
|
43
|
+
"packets" => 0,
|
44
|
+
"errors" => 0,
|
45
|
+
"drop" => 0,
|
46
|
+
"overrun" => 0,
|
47
|
+
"collisions" => 0,
|
48
|
+
"carrier" => 0,
|
49
|
+
"compressed" => 0,
|
50
50
|
},
|
51
51
|
},
|
52
52
|
},
|
@@ -55,170 +55,170 @@ module Fauxhai
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def current_user
|
58
|
-
|
58
|
+
"fauxhai"
|
59
59
|
end
|
60
60
|
|
61
61
|
def default_gateway
|
62
|
-
|
62
|
+
"10.0.0.1"
|
63
63
|
end
|
64
64
|
|
65
65
|
def default_interface
|
66
|
-
case @system.data[
|
67
|
-
when
|
68
|
-
|
66
|
+
case @system.data["platform_family"]
|
67
|
+
when "mac_os_x"
|
68
|
+
"en0"
|
69
69
|
when /bsd/
|
70
|
-
|
71
|
-
when
|
72
|
-
|
70
|
+
"em0"
|
71
|
+
when "arch", "fedora"
|
72
|
+
"enp0s3"
|
73
73
|
else
|
74
|
-
|
74
|
+
"eth0"
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
78
|
def domain
|
79
|
-
|
79
|
+
"local"
|
80
80
|
end
|
81
81
|
|
82
82
|
def fqdn
|
83
|
-
|
83
|
+
"fauxhai.local"
|
84
84
|
end
|
85
85
|
|
86
86
|
def gem_bin
|
87
|
-
|
87
|
+
"/usr/local/bin/gem"
|
88
88
|
end
|
89
89
|
|
90
90
|
def gems_dir
|
91
|
-
|
91
|
+
"/usr/local/gems"
|
92
92
|
end
|
93
93
|
|
94
94
|
def hostname
|
95
|
-
|
95
|
+
"Fauxhai"
|
96
96
|
end
|
97
97
|
|
98
98
|
def ipaddress
|
99
|
-
|
99
|
+
"10.0.0.2"
|
100
100
|
end
|
101
101
|
|
102
102
|
def ip6address
|
103
|
-
|
103
|
+
"fe80:0:0:0:0:0:a00:2"
|
104
104
|
end
|
105
105
|
|
106
106
|
def keys
|
107
107
|
{
|
108
|
-
|
108
|
+
"ssh" => ssh,
|
109
109
|
}
|
110
110
|
end
|
111
111
|
|
112
112
|
def languages
|
113
113
|
{
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
114
|
+
"ruby" => @system.data["languages"]["ruby"].merge("bin_dir" => bin_dir,
|
115
|
+
"gem_bin" => gem_bin,
|
116
|
+
"gems_dir" => gems_dir,
|
117
|
+
"ruby_bin" => ruby_bin),
|
118
|
+
"powershell" => @system.data["languages"]["powershell"],
|
119
119
|
}
|
120
120
|
end
|
121
121
|
|
122
122
|
def macaddress
|
123
|
-
|
123
|
+
"11:11:11:11:11:11"
|
124
124
|
end
|
125
125
|
|
126
126
|
def network
|
127
127
|
{
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
128
|
+
"interfaces" => {
|
129
|
+
"lo" => {
|
130
|
+
"mtu" => "65536",
|
131
|
+
"flags" => %w{LOOPBACK UP LOWER_UP},
|
132
|
+
"encapsulation" => "Loopback",
|
133
|
+
"addresses" => {
|
134
|
+
"127.0.0.1" => {
|
135
|
+
"family" => "inet",
|
136
|
+
"prefixlen" => "8",
|
137
|
+
"netmask" => "255.0.0.0",
|
138
|
+
"scope" => "Node",
|
139
|
+
"ip_scope" => "LOOPBACK",
|
140
140
|
},
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
141
|
+
"::1" => {
|
142
|
+
"family" => "inet6",
|
143
|
+
"prefixlen" => "128",
|
144
|
+
"scope" => "Node",
|
145
|
+
"tags" => [],
|
146
|
+
"ip_scope" => "LINK LOCAL LOOPBACK",
|
147
147
|
},
|
148
148
|
},
|
149
|
-
|
149
|
+
"state" => "unknown",
|
150
150
|
},
|
151
151
|
default_interface.to_s => {
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
152
|
+
"type" => default_interface.chop,
|
153
|
+
"number" => "0",
|
154
|
+
"mtu" => "1500",
|
155
|
+
"flags" => %w{BROADCAST MULTICAST UP LOWER_UP},
|
156
|
+
"encapsulation" => "Ethernet",
|
157
|
+
"addresses" => {
|
158
158
|
macaddress.to_s => {
|
159
|
-
|
159
|
+
"family" => "lladdr",
|
160
160
|
},
|
161
161
|
ipaddress.to_s => {
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
162
|
+
"family" => "inet",
|
163
|
+
"prefixlen" => "24",
|
164
|
+
"netmask" => "255.255.255.0",
|
165
|
+
"broadcast" => "10.0.0.255",
|
166
|
+
"scope" => "Global",
|
167
|
+
"ip_scope" => "RFC1918 PRIVATE",
|
168
168
|
},
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
169
|
+
"fe80::11:1111:1111:1111" => {
|
170
|
+
"family" => "inet6",
|
171
|
+
"prefixlen" => "64",
|
172
|
+
"scope" => "Link",
|
173
|
+
"tags" => [],
|
174
|
+
"ip_scope" => "LINK LOCAL UNICAST",
|
175
175
|
},
|
176
176
|
},
|
177
|
-
|
178
|
-
|
179
|
-
|
177
|
+
"state" => "up",
|
178
|
+
"arp" => {
|
179
|
+
"10.0.0.1" => "fe:ff:ff:ff:ff:ff",
|
180
180
|
},
|
181
|
-
|
181
|
+
"routes" => [
|
182
182
|
{
|
183
|
-
|
184
|
-
|
185
|
-
|
183
|
+
"destination" => "default",
|
184
|
+
"family" => "inet",
|
185
|
+
"via" => default_gateway,
|
186
186
|
},
|
187
187
|
{
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
188
|
+
"destination" => "10.0.0.0/24",
|
189
|
+
"family" => "inet",
|
190
|
+
"scope" => "link",
|
191
|
+
"proto" => "kernel",
|
192
|
+
"src" => ipaddress,
|
193
193
|
},
|
194
194
|
{
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
195
|
+
"destination" => "fe80::/64",
|
196
|
+
"family" => "inet6",
|
197
|
+
"metric" => "256",
|
198
|
+
"proto" => "kernel",
|
199
199
|
},
|
200
200
|
],
|
201
|
-
|
201
|
+
"ring_params" => {},
|
202
202
|
},
|
203
203
|
},
|
204
|
-
|
205
|
-
|
204
|
+
"default_interface" => default_interface,
|
205
|
+
"default_gateway" => default_gateway,
|
206
206
|
}
|
207
207
|
end
|
208
208
|
|
209
209
|
def ruby_bin
|
210
|
-
|
210
|
+
"/usr/local/bin/ruby"
|
211
211
|
end
|
212
212
|
|
213
213
|
def ssh
|
214
214
|
{
|
215
|
-
|
216
|
-
|
215
|
+
"host_dsa_public" => File.read(File.join(Fauxhai.root, "lib", "fauxhai", "keys", "id_dsa.pub")).strip,
|
216
|
+
"host_rsa_public" => File.read(File.join(Fauxhai.root, "lib", "fauxhai", "keys", "id_rsa.pub")).strip,
|
217
217
|
}
|
218
218
|
end
|
219
219
|
|
220
220
|
def uptime
|
221
|
-
|
221
|
+
"30 days 15 hours 07 minutes 30 seconds"
|
222
222
|
end
|
223
223
|
|
224
224
|
def uptime_seconds
|
@@ -227,27 +227,27 @@ module Fauxhai
|
|
227
227
|
|
228
228
|
def cpu
|
229
229
|
{
|
230
|
-
|
231
|
-
|
232
|
-
|
230
|
+
"real" => 1,
|
231
|
+
"total" => 1,
|
232
|
+
"cores" => 1,
|
233
233
|
}
|
234
234
|
end
|
235
235
|
|
236
236
|
def memory
|
237
237
|
{
|
238
|
-
|
238
|
+
"total" => "1048576kB",
|
239
239
|
}
|
240
240
|
end
|
241
241
|
|
242
242
|
def virtualization
|
243
243
|
{
|
244
|
-
|
244
|
+
"systems" => {},
|
245
245
|
}
|
246
246
|
end
|
247
247
|
|
248
248
|
def time
|
249
249
|
{
|
250
|
-
|
250
|
+
"timezone" => "GMT",
|
251
251
|
}
|
252
252
|
end
|
253
253
|
|
@@ -256,7 +256,7 @@ module Fauxhai
|
|
256
256
|
#
|
257
257
|
# @return [Array] - the key of whitelisted attributes
|
258
258
|
def whitelist_attributes
|
259
|
-
%w
|
259
|
+
%w{
|
260
260
|
block_device
|
261
261
|
chef_packages
|
262
262
|
command
|
@@ -277,7 +277,7 @@ module Fauxhai
|
|
277
277
|
root_group
|
278
278
|
shard_seed
|
279
279
|
shells
|
280
|
-
|
280
|
+
}
|
281
281
|
end
|
282
282
|
end
|
283
283
|
end
|