chef-utils 0.0.1 → 15.5.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/chef-utils.gemspec +11 -3
- data/lib/chef-utils.rb +43 -0
- data/lib/chef-utils/dsl/architecture.rb +117 -0
- data/lib/chef-utils/dsl/introspection.rb +93 -0
- data/lib/chef-utils/dsl/os.rb +55 -0
- data/lib/chef-utils/dsl/path_sanity.rb +58 -0
- data/lib/chef-utils/dsl/platform.rb +339 -0
- data/lib/chef-utils/dsl/platform_family.rb +314 -0
- data/lib/chef-utils/dsl/service.rb +91 -0
- data/lib/chef-utils/dsl/train_helpers.rb +63 -0
- data/lib/chef-utils/dsl/which.rb +118 -0
- data/lib/chef-utils/internal.rb +77 -0
- data/lib/chef-utils/mash.rb +239 -0
- data/lib/chef-utils/version.rb +1 -1
- data/spec/spec_helper.rb +93 -0
- data/spec/unit/dsl/architecture_spec.rb +139 -0
- data/spec/unit/dsl/dsl_spec.rb +33 -0
- data/spec/unit/dsl/introspection_spec.rb +168 -0
- data/spec/unit/dsl/os_spec.rb +174 -0
- data/spec/unit/dsl/path_sanity_spec.rb +85 -0
- data/spec/unit/dsl/platform_family_spec.rb +222 -0
- data/spec/unit/dsl/platform_spec.rb +234 -0
- data/spec/unit/dsl/service_spec.rb +116 -0
- data/spec/unit/dsl/which_spec.rb +168 -0
- data/spec/unit/mash_spec.rb +50 -0
- metadata +35 -7
@@ -0,0 +1,85 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright 2018-2019, Chef Software Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require "spec_helper"
|
19
|
+
|
20
|
+
RSpec.describe ChefUtils::DSL::PathSanity do
|
21
|
+
class PathSanityTestClass
|
22
|
+
include ChefUtils::DSL::PathSanity
|
23
|
+
end
|
24
|
+
|
25
|
+
before do
|
26
|
+
allow(Gem).to receive(:bindir).and_return("/opt/ruby/bin/bundle")
|
27
|
+
allow(RbConfig::CONFIG).to receive(:[]).with("bindir").and_return("/opt/ruby/bin")
|
28
|
+
end
|
29
|
+
|
30
|
+
context "on unix" do
|
31
|
+
before do
|
32
|
+
allow(ChefUtils).to receive(:windows?).and_return(false)
|
33
|
+
end
|
34
|
+
|
35
|
+
let(:test_instance) { PathSanityTestClass.new }
|
36
|
+
|
37
|
+
it "works with no path" do
|
38
|
+
env = {}
|
39
|
+
expect(test_instance.sanitized_path(env)).to eql("#{Gem.bindir}:#{RbConfig::CONFIG["bindir"]}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin")
|
40
|
+
end
|
41
|
+
|
42
|
+
it "works with nil path" do
|
43
|
+
env = { "PATH" => nil }
|
44
|
+
expect(test_instance.sanitized_path(env)).to eql("#{Gem.bindir}:#{RbConfig::CONFIG["bindir"]}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin")
|
45
|
+
end
|
46
|
+
|
47
|
+
it "works with empty path" do
|
48
|
+
env = { "PATH" => "" }
|
49
|
+
expect(test_instance.sanitized_path(env)).to eql("#{Gem.bindir}:#{RbConfig::CONFIG["bindir"]}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin")
|
50
|
+
end
|
51
|
+
|
52
|
+
it "appends the sane_paths to the end of the path, preserving any that already exist, in the same order" do
|
53
|
+
env = { "PATH" => "/bin:/opt/app/bin:/sbin" }
|
54
|
+
expect(test_instance.sanitized_path(env)).to eql("#{Gem.bindir}:#{RbConfig::CONFIG["bindir"]}:/bin:/opt/app/bin:/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
context "on windows" do
|
59
|
+
before do
|
60
|
+
allow(ChefUtils).to receive(:windows?).and_return(true)
|
61
|
+
end
|
62
|
+
|
63
|
+
let(:test_instance) { PathSanityTestClass.new }
|
64
|
+
|
65
|
+
it "works with no path" do
|
66
|
+
env = {}
|
67
|
+
expect(test_instance.sanitized_path(env)).to eql("#{Gem.bindir};#{RbConfig::CONFIG["bindir"]}")
|
68
|
+
end
|
69
|
+
|
70
|
+
it "works with nil path" do
|
71
|
+
env = { "PATH" => nil }
|
72
|
+
expect(test_instance.sanitized_path(env)).to eql("#{Gem.bindir};#{RbConfig::CONFIG["bindir"]}")
|
73
|
+
end
|
74
|
+
|
75
|
+
it "works with empty path" do
|
76
|
+
env = { "PATH" => "" }
|
77
|
+
expect(test_instance.sanitized_path(env)).to eql("#{Gem.bindir};#{RbConfig::CONFIG["bindir"]}")
|
78
|
+
end
|
79
|
+
|
80
|
+
it "prepends to an existing path" do
|
81
|
+
env = { "PATH" => '%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\\' }
|
82
|
+
expect(test_instance.sanitized_path(env)).to eql("#{Gem.bindir};#{RbConfig::CONFIG["bindir"]};%SystemRoot%\\system32;%SystemRoot%;%SystemRoot%\\System32\\Wbem;%SYSTEMROOT%\\System32\\WindowsPowerShell\\v1.0\\")
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,222 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright 2018-2019, Chef Software Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require "spec_helper"
|
19
|
+
require "fauxhai"
|
20
|
+
|
21
|
+
def pf_reports_true_for(*args)
|
22
|
+
args.each do |method|
|
23
|
+
it "reports true for #{method}" do
|
24
|
+
expect(described_class.send(method, node)).to be true
|
25
|
+
end
|
26
|
+
end
|
27
|
+
(PLATFORM_FAMILY_HELPERS - [ :windows_ruby? ] - args).each do |method|
|
28
|
+
it "reports false for #{method}" do
|
29
|
+
expect(described_class.send(method, node)).to be false
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
RSpec.describe ChefUtils::DSL::PlatformFamily do
|
35
|
+
let(:node) { Fauxhai.mock(options).data }
|
36
|
+
|
37
|
+
( HELPER_MODULES - [ described_class ] ).each do |klass|
|
38
|
+
it "does not have methods that collide with #{klass}" do
|
39
|
+
expect((klass.methods - Module.methods) & PLATFORM_FAMILY_HELPERS).to be_empty
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
( PLATFORM_FAMILY_HELPERS - [ :windows_ruby? ]).each do |helper|
|
44
|
+
it "has the #{helper} in the ChefUtils module" do
|
45
|
+
expect(ChefUtils).to respond_to(helper)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context "on ubuntu" do
|
50
|
+
let(:options) { { platform: "ubuntu" } }
|
51
|
+
|
52
|
+
pf_reports_true_for(:debian?)
|
53
|
+
end
|
54
|
+
|
55
|
+
context "on raspbian" do
|
56
|
+
let(:options) { { platform: "raspbian" } }
|
57
|
+
|
58
|
+
pf_reports_true_for(:debian?)
|
59
|
+
end
|
60
|
+
|
61
|
+
context "on linuxmint" do
|
62
|
+
let(:options) { { platform: "linuxmint" } }
|
63
|
+
|
64
|
+
pf_reports_true_for(:debian?)
|
65
|
+
end
|
66
|
+
|
67
|
+
context "on debian" do
|
68
|
+
let(:options) { { platform: "debian" } }
|
69
|
+
|
70
|
+
pf_reports_true_for(:debian?)
|
71
|
+
end
|
72
|
+
|
73
|
+
context "on aix" do
|
74
|
+
let(:options) { { platform: "aix" } }
|
75
|
+
|
76
|
+
pf_reports_true_for(:aix?)
|
77
|
+
end
|
78
|
+
|
79
|
+
context "on amazon" do
|
80
|
+
let(:options) { { platform: "amazon" } }
|
81
|
+
|
82
|
+
pf_reports_true_for(:amazon?, :amazon_linux?, :rpm_based?, :fedora_derived?)
|
83
|
+
end
|
84
|
+
|
85
|
+
context "on arch" do
|
86
|
+
let(:options) { { platform: "arch" } }
|
87
|
+
|
88
|
+
pf_reports_true_for(:arch?, :arch_linux?)
|
89
|
+
end
|
90
|
+
|
91
|
+
context "on centos6" do
|
92
|
+
let(:options) { { platform: "centos", version: "6.9" } }
|
93
|
+
|
94
|
+
pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel6?)
|
95
|
+
end
|
96
|
+
|
97
|
+
context "on centos7" do
|
98
|
+
let(:options) { { platform: "centos", version: "7.7.1908" } }
|
99
|
+
|
100
|
+
pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel7?)
|
101
|
+
end
|
102
|
+
|
103
|
+
context "on centos8" do
|
104
|
+
let(:options) { { platform: "centos", version: "8" } }
|
105
|
+
|
106
|
+
pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel8?)
|
107
|
+
end
|
108
|
+
|
109
|
+
context "on clearos7" do
|
110
|
+
let(:options) { { platform: "clearos", version: "7.4" } }
|
111
|
+
|
112
|
+
pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel7?)
|
113
|
+
end
|
114
|
+
|
115
|
+
context "on dragonfly4" do
|
116
|
+
let(:options) { { platform: "dragonfly4" } }
|
117
|
+
|
118
|
+
pf_reports_true_for(:dragonflybsd?)
|
119
|
+
end
|
120
|
+
|
121
|
+
context "on fedora" do
|
122
|
+
let(:options) { { platform: "fedora" } }
|
123
|
+
|
124
|
+
pf_reports_true_for(:fedora?, :rpm_based?, :fedora_derived?, :redhat_based?)
|
125
|
+
end
|
126
|
+
|
127
|
+
context "on freebsd" do
|
128
|
+
let(:options) { { platform: "freebsd" } }
|
129
|
+
|
130
|
+
pf_reports_true_for(:freebsd?, :bsd_based?)
|
131
|
+
end
|
132
|
+
|
133
|
+
context "on gentoo" do
|
134
|
+
let(:options) { { platform: "gentoo" } }
|
135
|
+
|
136
|
+
pf_reports_true_for(:gentoo?)
|
137
|
+
end
|
138
|
+
|
139
|
+
context "on mac_os_x" do
|
140
|
+
let(:options) { { platform: "mac_os_x" } }
|
141
|
+
|
142
|
+
pf_reports_true_for(:mac_os_x?, :mac?, :osx?, :macos?)
|
143
|
+
end
|
144
|
+
|
145
|
+
context "on openbsd" do
|
146
|
+
let(:options) { { platform: "openbsd" } }
|
147
|
+
|
148
|
+
pf_reports_true_for(:openbsd?, :bsd_based?)
|
149
|
+
end
|
150
|
+
|
151
|
+
context "on opensuse" do
|
152
|
+
let(:options) { { platform: "opensuse" } }
|
153
|
+
|
154
|
+
pf_reports_true_for(:suse?, :rpm_based?)
|
155
|
+
end
|
156
|
+
|
157
|
+
context "on oracle6" do
|
158
|
+
let(:options) { { platform: "oracle", version: "6.10" } }
|
159
|
+
|
160
|
+
pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel6?)
|
161
|
+
end
|
162
|
+
|
163
|
+
context "on oracle7" do
|
164
|
+
let(:options) { { platform: "oracle", version: "7.6" } }
|
165
|
+
|
166
|
+
pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel7?)
|
167
|
+
end
|
168
|
+
|
169
|
+
context "on redhat6" do
|
170
|
+
let(:options) { { platform: "redhat", version: "6.9" } }
|
171
|
+
|
172
|
+
pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel6?)
|
173
|
+
end
|
174
|
+
|
175
|
+
context "on redhat7" do
|
176
|
+
let(:options) { { platform: "redhat", version: "7.6" } }
|
177
|
+
|
178
|
+
pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel7?)
|
179
|
+
end
|
180
|
+
|
181
|
+
context "on redhat8" do
|
182
|
+
let(:options) { { platform: "redhat", version: "8" } }
|
183
|
+
|
184
|
+
pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel8?)
|
185
|
+
end
|
186
|
+
|
187
|
+
context "on smartos" do
|
188
|
+
let(:options) { { platform: "smartos" } }
|
189
|
+
|
190
|
+
pf_reports_true_for(:smartos?, :solaris_based?)
|
191
|
+
end
|
192
|
+
|
193
|
+
context "on solaris2" do
|
194
|
+
let(:options) { { platform: "solaris2" } }
|
195
|
+
|
196
|
+
pf_reports_true_for(:solaris?, :solaris2?, :solaris_based?)
|
197
|
+
end
|
198
|
+
|
199
|
+
context "on suse" do
|
200
|
+
let(:options) { { platform: "suse" } }
|
201
|
+
|
202
|
+
pf_reports_true_for(:suse?, :rpm_based?)
|
203
|
+
end
|
204
|
+
|
205
|
+
context "on windows" do
|
206
|
+
let(:options) { { platform: "windows" } }
|
207
|
+
|
208
|
+
pf_reports_true_for(:windows?)
|
209
|
+
end
|
210
|
+
|
211
|
+
context "node-independent windows APIs" do
|
212
|
+
if RUBY_PLATFORM =~ /mswin|mingw32|windows/
|
213
|
+
it "reports true for :windows_ruby?" do
|
214
|
+
expect(described_class.windows_ruby?).to be true
|
215
|
+
end
|
216
|
+
else
|
217
|
+
it "reports false for :windows_ruby?" do
|
218
|
+
expect(described_class.windows_ruby?).to be false
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
222
|
+
end
|
@@ -0,0 +1,234 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright 2018-2019, Chef Software Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require "spec_helper"
|
19
|
+
require "fauxhai"
|
20
|
+
|
21
|
+
def platform_reports_true_for(*args)
|
22
|
+
args.each do |method|
|
23
|
+
it "reports true for #{method} on the module given a node" do
|
24
|
+
expect(described_class.send(method, node)).to be true
|
25
|
+
end
|
26
|
+
it "reports true for #{method} when mixed into a class with a node" do
|
27
|
+
expect(thing_with_a_node.send(method, node)).to be true
|
28
|
+
end
|
29
|
+
it "reports true for #{method} when mixed into a class with a run_context" do
|
30
|
+
expect(thing_with_a_run_context.send(method, node)).to be true
|
31
|
+
end
|
32
|
+
it "reports true for #{method} when mixed into a class with the dsl" do
|
33
|
+
expect(thing_with_the_dsl.send(method, node)).to be true
|
34
|
+
end
|
35
|
+
it "reports true for #{method} on the main class give a node" do
|
36
|
+
expect(ChefUtils.send(method, node)).to be true
|
37
|
+
end
|
38
|
+
end
|
39
|
+
(PLATFORM_HELPERS - args).each do |method|
|
40
|
+
it "reports false for #{method} on the module given a node" do
|
41
|
+
expect(described_class.send(method, node)).to be false
|
42
|
+
end
|
43
|
+
it "reports false for #{method} when mixed into a class with a node" do
|
44
|
+
expect(thing_with_a_node.send(method, node)).to be false
|
45
|
+
end
|
46
|
+
it "reports false for #{method} when mixed into a class with the dsl" do
|
47
|
+
expect(thing_with_the_dsl.send(method, node)).to be false
|
48
|
+
end
|
49
|
+
it "reports false for #{method} on the main class give a node" do
|
50
|
+
expect(ChefUtils.send(method, node)).to be false
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
RSpec.describe ChefUtils::DSL::Platform do
|
56
|
+
let(:node) { Fauxhai.mock(options).data }
|
57
|
+
|
58
|
+
class ThingWithANode
|
59
|
+
include ChefUtils::DSL::Platform
|
60
|
+
attr_accessor :node
|
61
|
+
def initialize(node)
|
62
|
+
@node = node
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
class ThingWithARunContext
|
67
|
+
include ChefUtils::DSL::Platform
|
68
|
+
class RunContext
|
69
|
+
attr_accessor :node
|
70
|
+
end
|
71
|
+
attr_accessor :run_context
|
72
|
+
def initialize(node)
|
73
|
+
@run_context = RunContext.new
|
74
|
+
run_context.node = node
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
class ThingWithTheDSL
|
79
|
+
include ChefUtils
|
80
|
+
attr_accessor :node
|
81
|
+
def initialize(node)
|
82
|
+
@node = node
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
let(:thing_with_a_node) { ThingWithANode.new(node) }
|
87
|
+
let(:thing_with_a_run_context) { ThingWithARunContext.new(node) }
|
88
|
+
let(:thing_with_the_dsl) { ThingWithTheDSL.new(node) }
|
89
|
+
|
90
|
+
( HELPER_MODULES - [ described_class ] ).each do |klass|
|
91
|
+
it "does not have methods that collide with #{klass}" do
|
92
|
+
expect((klass.methods - Module.methods) & PLATFORM_HELPERS).to be_empty
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
context "on ubuntu" do
|
97
|
+
let(:options) { { platform: "ubuntu" } }
|
98
|
+
|
99
|
+
platform_reports_true_for(:ubuntu?, :ubuntu_platform?)
|
100
|
+
end
|
101
|
+
|
102
|
+
context "on raspbian" do
|
103
|
+
let(:options) { { platform: "raspbian" } }
|
104
|
+
|
105
|
+
platform_reports_true_for(:raspbian?, :raspbian_platform?)
|
106
|
+
end
|
107
|
+
|
108
|
+
context "on linuxmint" do
|
109
|
+
let(:options) { { platform: "linuxmint" } }
|
110
|
+
|
111
|
+
platform_reports_true_for(:mint?, :linux_mint?, :linuxmint?, :linuxmint_platform?)
|
112
|
+
end
|
113
|
+
|
114
|
+
context "on debian" do
|
115
|
+
let(:options) { { platform: "debian" } }
|
116
|
+
|
117
|
+
platform_reports_true_for(:debian_platform?)
|
118
|
+
end
|
119
|
+
|
120
|
+
context "on aix" do
|
121
|
+
let(:options) { { platform: "aix" } }
|
122
|
+
|
123
|
+
platform_reports_true_for(:aix_platform?)
|
124
|
+
end
|
125
|
+
|
126
|
+
context "on amazon" do
|
127
|
+
let(:options) { { platform: "amazon" } }
|
128
|
+
|
129
|
+
platform_reports_true_for(:amazon_platform?)
|
130
|
+
end
|
131
|
+
|
132
|
+
context "on arch" do
|
133
|
+
let(:options) { { platform: "arch" } }
|
134
|
+
|
135
|
+
platform_reports_true_for(:arch_platform?)
|
136
|
+
end
|
137
|
+
|
138
|
+
context "on centos" do
|
139
|
+
let(:options) { { platform: "centos" } }
|
140
|
+
|
141
|
+
platform_reports_true_for(:centos?, :centos_platform?)
|
142
|
+
end
|
143
|
+
|
144
|
+
context "on clearos" do
|
145
|
+
let(:options) { { platform: "clearos" } }
|
146
|
+
|
147
|
+
platform_reports_true_for(:clearos?, :clearos_platform?)
|
148
|
+
end
|
149
|
+
|
150
|
+
context "on dragonfly4" do
|
151
|
+
let(:options) { { platform: "dragonfly4" } }
|
152
|
+
|
153
|
+
platform_reports_true_for(:dragonfly_platform?)
|
154
|
+
end
|
155
|
+
|
156
|
+
context "on fedora" do
|
157
|
+
let(:options) { { platform: "fedora" } }
|
158
|
+
|
159
|
+
platform_reports_true_for(:fedora_platform?)
|
160
|
+
end
|
161
|
+
|
162
|
+
context "on freebsd" do
|
163
|
+
let(:options) { { platform: "freebsd" } }
|
164
|
+
|
165
|
+
platform_reports_true_for(:freebsd_platform?)
|
166
|
+
end
|
167
|
+
|
168
|
+
context "on gentoo" do
|
169
|
+
let(:options) { { platform: "gentoo" } }
|
170
|
+
|
171
|
+
platform_reports_true_for(:gentoo_platform?)
|
172
|
+
end
|
173
|
+
|
174
|
+
context "on mac_os_x" do
|
175
|
+
let(:options) { { platform: "mac_os_x" } }
|
176
|
+
|
177
|
+
platform_reports_true_for(:mac_os_x_platform?, :macos_platform?)
|
178
|
+
end
|
179
|
+
|
180
|
+
context "on openbsd" do
|
181
|
+
let(:options) { { platform: "openbsd" } }
|
182
|
+
|
183
|
+
platform_reports_true_for(:openbsd_platform?)
|
184
|
+
end
|
185
|
+
|
186
|
+
context "on oracle" do
|
187
|
+
let(:options) { { platform: "oracle" } }
|
188
|
+
|
189
|
+
platform_reports_true_for(:oracle?, :oracle_linux?, :oracle_platform?)
|
190
|
+
end
|
191
|
+
|
192
|
+
context "on redhat" do
|
193
|
+
let(:options) { { platform: "redhat" } }
|
194
|
+
|
195
|
+
platform_reports_true_for(:redhat?, :redhat_enterprise_linux?, :redhat_enterprise?, :redhat_platform?)
|
196
|
+
end
|
197
|
+
|
198
|
+
context "on smartos" do
|
199
|
+
let(:options) { { platform: "smartos" } }
|
200
|
+
|
201
|
+
platform_reports_true_for(:smartos_platform?)
|
202
|
+
end
|
203
|
+
|
204
|
+
context "on solaris2" do
|
205
|
+
let(:options) { { platform: "solaris2" } }
|
206
|
+
|
207
|
+
platform_reports_true_for(:solaris2_platform?)
|
208
|
+
end
|
209
|
+
|
210
|
+
context "on suse" do
|
211
|
+
let(:options) { { platform: "suse" } }
|
212
|
+
|
213
|
+
platform_reports_true_for(:suse_platform?)
|
214
|
+
end
|
215
|
+
|
216
|
+
context "on windows" do
|
217
|
+
let(:options) { { platform: "windows" } }
|
218
|
+
|
219
|
+
platform_reports_true_for(:windows_platform?)
|
220
|
+
end
|
221
|
+
|
222
|
+
context "on opensuseleap" do
|
223
|
+
let(:node) { { "platform" => "opensuseleap", "platform_version" => "15.1", "platform_family" => "suse", "os" => "linux" } }
|
224
|
+
|
225
|
+
platform_reports_true_for(:opensuse_platform?, :opensuseleap_platform?, :opensuse?, :leap_platform?)
|
226
|
+
end
|
227
|
+
|
228
|
+
context "on opensuse" do
|
229
|
+
let(:node) { { "platform" => "opensuse", "platform_version" => "11.0", "platform_family" => "suse", "os" => "linux" } }
|
230
|
+
|
231
|
+
platform_reports_true_for(:opensuse_platform?, :opensuseleap_platform?, :opensuse?, :leap_platform?)
|
232
|
+
end
|
233
|
+
|
234
|
+
end
|