fauxhai-chef 9.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +2 -0
  3. data/LICENSE +22 -0
  4. data/bin/fauxhai +23 -0
  5. data/fauxhai-chef.gemspec +28 -0
  6. data/lib/fauxhai/exception.rb +6 -0
  7. data/lib/fauxhai/fetcher.rb +80 -0
  8. data/lib/fauxhai/keys/id_dsa +12 -0
  9. data/lib/fauxhai/keys/id_dsa.pub +1 -0
  10. data/lib/fauxhai/keys/id_rsa +27 -0
  11. data/lib/fauxhai/keys/id_rsa.pub +1 -0
  12. data/lib/fauxhai/mocker.rb +143 -0
  13. data/lib/fauxhai/platforms/aix/7.1.json +1889 -0
  14. data/lib/fauxhai/platforms/aix/7.2.json +5289 -0
  15. data/lib/fauxhai/platforms/almalinux/8.json +5754 -0
  16. data/lib/fauxhai/platforms/amazon/2.json +4697 -0
  17. data/lib/fauxhai/platforms/amazon/2018.03.json +3525 -0
  18. data/lib/fauxhai/platforms/arch/4.10.13-1-ARCH.json +1669 -0
  19. data/lib/fauxhai/platforms/centos/6.10.json +2691 -0
  20. data/lib/fauxhai/platforms/centos/7.7.1908.json +3855 -0
  21. data/lib/fauxhai/platforms/centos/7.8.2003.json +3803 -0
  22. data/lib/fauxhai/platforms/centos/8.json +4715 -0
  23. data/lib/fauxhai/platforms/chefspec/0.6.1.json +20 -0
  24. data/lib/fauxhai/platforms/clearos/7.4.json +6130 -0
  25. data/lib/fauxhai/platforms/debian/10.json +2928 -0
  26. data/lib/fauxhai/platforms/debian/11.json +2744 -0
  27. data/lib/fauxhai/platforms/debian/9.11.json +2943 -0
  28. data/lib/fauxhai/platforms/debian/9.12.json +2942 -0
  29. data/lib/fauxhai/platforms/debian/9.13.json +2959 -0
  30. data/lib/fauxhai/platforms/dragonfly4/4.8-RELEASE.json +392 -0
  31. data/lib/fauxhai/platforms/fedora/31.json +3994 -0
  32. data/lib/fauxhai/platforms/fedora/32.json +3554 -0
  33. data/lib/fauxhai/platforms/freebsd/11.2.json +427 -0
  34. data/lib/fauxhai/platforms/freebsd/12.1.json +913 -0
  35. data/lib/fauxhai/platforms/gentoo/4.9.95-gentoo.json +989 -0
  36. data/lib/fauxhai/platforms/linuxmint/19.0.json +9649 -0
  37. data/lib/fauxhai/platforms/mac_os_x/10.14.json +1350 -0
  38. data/lib/fauxhai/platforms/mac_os_x/10.15.json +1510 -0
  39. data/lib/fauxhai/platforms/mac_os_x/11.0.json +2821 -0
  40. data/lib/fauxhai/platforms/mac_os_x/11.json +3356 -0
  41. data/lib/fauxhai/platforms/mac_os_x/12.json +3546 -0
  42. data/lib/fauxhai/platforms/openbsd/6.2.json +295 -0
  43. data/lib/fauxhai/platforms/opensuse/15.2.json +5967 -0
  44. data/lib/fauxhai/platforms/oracle/6.10.json +4349 -0
  45. data/lib/fauxhai/platforms/oracle/7.5.json +6576 -0
  46. data/lib/fauxhai/platforms/oracle/7.6.json +6591 -0
  47. data/lib/fauxhai/platforms/raspbian/10.json +3664 -0
  48. data/lib/fauxhai/platforms/redhat/6.10.json +5822 -0
  49. data/lib/fauxhai/platforms/redhat/7.7.json +3969 -0
  50. data/lib/fauxhai/platforms/redhat/7.8.json +3958 -0
  51. data/lib/fauxhai/platforms/redhat/7.9.json +3959 -0
  52. data/lib/fauxhai/platforms/redhat/8.json +4547 -0
  53. data/lib/fauxhai/platforms/rocky/8.json +5768 -0
  54. data/lib/fauxhai/platforms/smartos/5.11.json +1680 -0
  55. data/lib/fauxhai/platforms/solaris2/5.11.json +10290 -0
  56. data/lib/fauxhai/platforms/suse/12.4.json +5875 -0
  57. data/lib/fauxhai/platforms/suse/12.5.json +5012 -0
  58. data/lib/fauxhai/platforms/suse/15.json +6096 -0
  59. data/lib/fauxhai/platforms/ubuntu/16.04.json +3885 -0
  60. data/lib/fauxhai/platforms/ubuntu/18.04.json +4042 -0
  61. data/lib/fauxhai/platforms/ubuntu/20.04.json +4613 -0
  62. data/lib/fauxhai/platforms/windows/10.json +431 -0
  63. data/lib/fauxhai/platforms/windows/2012.json +404 -0
  64. data/lib/fauxhai/platforms/windows/2012R2.json +406 -0
  65. data/lib/fauxhai/platforms/windows/2016.json +408 -0
  66. data/lib/fauxhai/platforms/windows/2019.json +408 -0
  67. data/lib/fauxhai/platforms/windows/8.1.json +416 -0
  68. data/lib/fauxhai/runner/default.rb +284 -0
  69. data/lib/fauxhai/runner/windows.rb +101 -0
  70. data/lib/fauxhai/runner.rb +45 -0
  71. data/lib/fauxhai/version.rb +3 -0
  72. data/lib/fauxhai.rb +18 -0
  73. metadata +202 -0
@@ -0,0 +1,101 @@
1
+ module Fauxhai
2
+ class Runner
3
+ module Windows
4
+ require_relative "default"
5
+ include ::Fauxhai::Runner::Default
6
+
7
+ def default_interface
8
+ "0xe"
9
+ end
10
+
11
+ def network
12
+ {
13
+ "interfaces" => {
14
+ "#{default_interface}" => {
15
+ "configuration" => {
16
+ "caption" => "[00000012] Ethernet Adapter",
17
+ "database_path" => '%SystemRoot%\\System32\\drivers\\etc',
18
+ "default_ip_gateway" => %w{default_gateway},
19
+ "description" => "Ethernet Adapter",
20
+ "dhcp_enabled" => false,
21
+ "dns_domain_suffix_search_order" => [],
22
+ "dns_enabled_for_wins_resolution" => false,
23
+ "dns_host_name" => hostname,
24
+ "domain_dns_registration_enabled" => false,
25
+ "full_dns_registration_enabled" => true,
26
+ "gateway_cost_metric" => [0],
27
+ "index" => 12,
28
+ "interface_index" => 14,
29
+ "ip_address" => [ipaddress],
30
+ "ip_connection_metric" => 5,
31
+ "ip_enabled" => true,
32
+ "ip_filter_security_enabled" => false,
33
+ "ip_sec_permit_ip_protocols" => [],
34
+ "ip_sec_permit_tcp_ports" => [],
35
+ "ip_sec_permit_udp_ports" => [],
36
+ "ip_subnet" => %w{255.255.255.0 64},
37
+ "mac_address" => macaddress,
38
+ "service_name" => "netkvm",
39
+ "setting_id" => "{00000000-0000-0000-0000-000000000000}",
40
+ "tcpip_netbios_options" => 0,
41
+ "tcp_window_size" => 64240,
42
+ "wins_enable_lm_hosts_lookup" => true,
43
+ "wins_scope_id" => "",
44
+ },
45
+ "instance" => {
46
+ "adapter_type" => "Ethernet 802.3",
47
+ "adapter_type_id" => 0,
48
+ "availability" => 3,
49
+ "caption" => "[00000012] Ethernet Adapter",
50
+ "config_manager_error_code" => 0,
51
+ "config_manager_user_config" => false,
52
+ "creation_class_name" => "Win32_NetworkAdapter",
53
+ "description" => "Ethernet Adapter",
54
+ "device_id" => "12",
55
+ "guid" => "{00000000-0000-0000-0000-000000000000}",
56
+ "index" => 12,
57
+ "installed" => true,
58
+ "interface_index" => 14,
59
+ "mac_address" => macaddress,
60
+ "manufacturer" => "",
61
+ "max_number_controlled" => 0,
62
+ "name" => "Ethernet Adapter",
63
+ "net_connection_id" => "Ethernet",
64
+ "net_connection_status" => 2,
65
+ "net_enabled" => true,
66
+ "physical_adapter" => true,
67
+ "pnp_device_id" => 'PCI\\VEN_0000&DEV_0000&SUBSYS_000000000&REV_00\\0&0000000000&00',
68
+ "power_management_supported" => false,
69
+ "product_name" => "Ethernet Adapter",
70
+ "service_name" => "netkvm",
71
+ "speed" => "10000000000",
72
+ "system_creation_class_name" => "Win32_ComputerSystem",
73
+ "system_name" => hostname,
74
+ "time_of_last_reset" => "20000101000001.000000+000",
75
+ },
76
+ "counters" => {},
77
+ "addresses" => {
78
+ "#{ipaddress}" => {
79
+ "prefixlen" => "24",
80
+ "netmask" => "255.255.255.0",
81
+ "broadcast" => "10.0.0.255",
82
+ "family" => "inet",
83
+ },
84
+ "#{macaddress}" => {
85
+ "family" => "lladdr",
86
+ },
87
+ },
88
+ "type" => "Ethernet 802.3",
89
+ "arp" => {
90
+ "10.0.0.1" => "fe:ff:ff:ff:ff:ff",
91
+ },
92
+ "encapsulation" => "Ethernet",
93
+ },
94
+ },
95
+ "default_gateway" => default_gateway,
96
+ "default_interface" => default_interface,
97
+ }
98
+ end
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,45 @@
1
+ require "ohai" unless defined?(Ohai::System)
2
+ require "ohai/plugins/chef"
3
+
4
+ module Fauxhai
5
+ class Runner
6
+ def initialize(args)
7
+ @system = Ohai::System.new
8
+ @system.all_plugins
9
+
10
+ case @system.data["platform"]
11
+ when "windows", :windows
12
+ require_relative "runner/windows"
13
+ singleton_class.send :include, ::Fauxhai::Runner::Windows
14
+ else
15
+ require_relative "runner/default"
16
+ singleton_class.send :include, ::Fauxhai::Runner::Default
17
+ end
18
+
19
+ result = @system.data.dup.delete_if { |k, v| !whitelist_attributes.include?(k) }.merge(
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
+ )
40
+
41
+ require "json" unless defined?(JSON)
42
+ puts JSON.pretty_generate(result.sort.to_h)
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,3 @@
1
+ module Fauxhai
2
+ VERSION = "9.3.2".freeze
3
+ end
data/lib/fauxhai.rb ADDED
@@ -0,0 +1,18 @@
1
+ module Fauxhai
2
+ autoload :Exception, "fauxhai/exception"
3
+ autoload :Fetcher, "fauxhai/fetcher"
4
+ autoload :Mocker, "fauxhai/mocker"
5
+ autoload :VERSION, "fauxhai/version"
6
+
7
+ def self.root
8
+ @@root ||= File.expand_path("../../", __FILE__)
9
+ end
10
+
11
+ def self.mock(*args, &block)
12
+ Fauxhai::Mocker.new(*args, &block)
13
+ end
14
+
15
+ def self.fetch(*args, &block)
16
+ Fauxhai::Fetcher.new(*args, &block)
17
+ end
18
+ end
metadata ADDED
@@ -0,0 +1,202 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fauxhai-chef
3
+ version: !ruby/object:Gem::Version
4
+ version: 9.3.2
5
+ platform: ruby
6
+ authors:
7
+ - Seth Vargo
8
+ - Tim Smith
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2022-06-13 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: net-ssh
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: chef
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '13.0'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '13.0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: ohai
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '13.0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '13.0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rake
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: rspec
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '3.7'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '3.7'
84
+ - !ruby/object:Gem::Dependency
85
+ name: rspec-its
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: '1.2'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: '1.2'
98
+ description: Easily mock out ohai data
99
+ email:
100
+ - sethvargo@gmail.com
101
+ - tsmith84@gmail.com
102
+ executables:
103
+ - fauxhai
104
+ extensions: []
105
+ extra_rdoc_files: []
106
+ files:
107
+ - Gemfile
108
+ - LICENSE
109
+ - bin/fauxhai
110
+ - fauxhai-chef.gemspec
111
+ - lib/fauxhai.rb
112
+ - lib/fauxhai/exception.rb
113
+ - lib/fauxhai/fetcher.rb
114
+ - lib/fauxhai/keys/id_dsa
115
+ - lib/fauxhai/keys/id_dsa.pub
116
+ - lib/fauxhai/keys/id_rsa
117
+ - lib/fauxhai/keys/id_rsa.pub
118
+ - lib/fauxhai/mocker.rb
119
+ - lib/fauxhai/platforms/aix/7.1.json
120
+ - lib/fauxhai/platforms/aix/7.2.json
121
+ - lib/fauxhai/platforms/almalinux/8.json
122
+ - lib/fauxhai/platforms/amazon/2.json
123
+ - lib/fauxhai/platforms/amazon/2018.03.json
124
+ - lib/fauxhai/platforms/arch/4.10.13-1-ARCH.json
125
+ - lib/fauxhai/platforms/centos/6.10.json
126
+ - lib/fauxhai/platforms/centos/7.7.1908.json
127
+ - lib/fauxhai/platforms/centos/7.8.2003.json
128
+ - lib/fauxhai/platforms/centos/8.json
129
+ - lib/fauxhai/platforms/chefspec/0.6.1.json
130
+ - lib/fauxhai/platforms/clearos/7.4.json
131
+ - lib/fauxhai/platforms/debian/10.json
132
+ - lib/fauxhai/platforms/debian/11.json
133
+ - lib/fauxhai/platforms/debian/9.11.json
134
+ - lib/fauxhai/platforms/debian/9.12.json
135
+ - lib/fauxhai/platforms/debian/9.13.json
136
+ - lib/fauxhai/platforms/dragonfly4/4.8-RELEASE.json
137
+ - lib/fauxhai/platforms/fedora/31.json
138
+ - lib/fauxhai/platforms/fedora/32.json
139
+ - lib/fauxhai/platforms/freebsd/11.2.json
140
+ - lib/fauxhai/platforms/freebsd/12.1.json
141
+ - lib/fauxhai/platforms/gentoo/4.9.95-gentoo.json
142
+ - lib/fauxhai/platforms/linuxmint/19.0.json
143
+ - lib/fauxhai/platforms/mac_os_x/10.14.json
144
+ - lib/fauxhai/platforms/mac_os_x/10.15.json
145
+ - lib/fauxhai/platforms/mac_os_x/11.0.json
146
+ - lib/fauxhai/platforms/mac_os_x/11.json
147
+ - lib/fauxhai/platforms/mac_os_x/12.json
148
+ - lib/fauxhai/platforms/openbsd/6.2.json
149
+ - lib/fauxhai/platforms/opensuse/15.2.json
150
+ - lib/fauxhai/platforms/oracle/6.10.json
151
+ - lib/fauxhai/platforms/oracle/7.5.json
152
+ - lib/fauxhai/platforms/oracle/7.6.json
153
+ - lib/fauxhai/platforms/raspbian/10.json
154
+ - lib/fauxhai/platforms/redhat/6.10.json
155
+ - lib/fauxhai/platforms/redhat/7.7.json
156
+ - lib/fauxhai/platforms/redhat/7.8.json
157
+ - lib/fauxhai/platforms/redhat/7.9.json
158
+ - lib/fauxhai/platforms/redhat/8.json
159
+ - lib/fauxhai/platforms/rocky/8.json
160
+ - lib/fauxhai/platforms/smartos/5.11.json
161
+ - lib/fauxhai/platforms/solaris2/5.11.json
162
+ - lib/fauxhai/platforms/suse/12.4.json
163
+ - lib/fauxhai/platforms/suse/12.5.json
164
+ - lib/fauxhai/platforms/suse/15.json
165
+ - lib/fauxhai/platforms/ubuntu/16.04.json
166
+ - lib/fauxhai/platforms/ubuntu/18.04.json
167
+ - lib/fauxhai/platforms/ubuntu/20.04.json
168
+ - lib/fauxhai/platforms/windows/10.json
169
+ - lib/fauxhai/platforms/windows/2012.json
170
+ - lib/fauxhai/platforms/windows/2012R2.json
171
+ - lib/fauxhai/platforms/windows/2016.json
172
+ - lib/fauxhai/platforms/windows/2019.json
173
+ - lib/fauxhai/platforms/windows/8.1.json
174
+ - lib/fauxhai/runner.rb
175
+ - lib/fauxhai/runner/default.rb
176
+ - lib/fauxhai/runner/windows.rb
177
+ - lib/fauxhai/version.rb
178
+ homepage: https://github.com/chef/fauxhai
179
+ licenses:
180
+ - MIT
181
+ metadata: {}
182
+ post_install_message:
183
+ rdoc_options: []
184
+ require_paths:
185
+ - lib
186
+ required_ruby_version: !ruby/object:Gem::Requirement
187
+ requirements:
188
+ - - ">="
189
+ - !ruby/object:Gem::Version
190
+ version: '2.7'
191
+ required_rubygems_version: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - ">="
194
+ - !ruby/object:Gem::Version
195
+ version: '0'
196
+ requirements: []
197
+ rubygems_version: 3.1.4
198
+ signing_key:
199
+ specification_version: 4
200
+ summary: Fauxhai provides an easy way to mock out your ohai data for testing with
201
+ chefspec!
202
+ test_files: []