chef-sugar 3.1.1 → 3.2.0
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/CHANGELOG.md +24 -0
- data/README.md +31 -0
- data/lib/chef/sugar.rb +1 -0
- data/lib/chef/sugar/architecture.rb +17 -2
- data/lib/chef/sugar/init.rb +61 -0
- data/lib/chef/sugar/platform.rb +55 -0
- data/lib/chef/sugar/platform_family.rb +12 -0
- data/lib/chef/sugar/version.rb +1 -1
- data/lib/chef/sugar/virtualization.rb +16 -0
- data/spec/unit/chef/sugar/architecture_spec.rb +16 -0
- data/spec/unit/chef/sugar/init_spec.rb +65 -0
- data/spec/unit/chef/sugar/platform_family_spec.rb +17 -0
- data/spec/unit/chef/sugar/platform_spec.rb +36 -0
- data/spec/unit/chef/sugar/virtualization_spec.rb +17 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4243d6a2e55c5d3e83160d715431a740038e4b4
|
4
|
+
data.tar.gz: 8f9091cee17fb78613e10c113b37ba13d247be49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f017af9a225a646e6e3d9676d9186497d48cbc15e79a0fd4ca09d0658cd0dd2fc71432275c1b1ca586cab9a5cc53ff4f7c8ef65c104970928b6a4c8b2565c431
|
7
|
+
data.tar.gz: 4f93d063e15757b9ad0adf442ab4d4172862a3b18eb0c85ed26867b2556e2c1cb71d9d5c06bb92503ddad3403fa2876d7c9edac68581ec8b8a933dc12a097fa1
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,30 @@ Chef Sugar Changelog
|
|
2
2
|
=========================
|
3
3
|
This file is used to list changes made in each version of the chef-sugar cookbook and gem.
|
4
4
|
|
5
|
+
v3.2.0 (2015-12-10)
|
6
|
+
-------------------
|
7
|
+
### Improvements
|
8
|
+
- Add platform matchers for `debian` and `fedora`
|
9
|
+
- Add `openvz` support under virtualization
|
10
|
+
- Add init system detection support
|
11
|
+
- Add support for `nexus`, `ios_xr` platforms and `wrlinux` platform_family
|
12
|
+
- Add additional `aix` helpers
|
13
|
+
|
14
|
+
### Bug Fixes
|
15
|
+
- Properly expose `Architecture#i386?` in the DSL
|
16
|
+
|
17
|
+
v3.1.1 (2015-06-23)
|
18
|
+
-------------------
|
19
|
+
### Improvements
|
20
|
+
- Update Intel CPU types based on existing Fauxhai data
|
21
|
+
- Update SPARC logic and 32/64-bit logic for x86 and i386
|
22
|
+
|
23
|
+
### Bug Fixes
|
24
|
+
- Fix 32-bit logic
|
25
|
+
- Fix default behavior to include chef-sugar at compile time
|
26
|
+
- Fix Chef 12.1.0 warnings for chef_gem compile time install
|
27
|
+
- Fix `redhat_enterprise_linux?` matcher
|
28
|
+
|
5
29
|
v3.0.2 (2015-03-26)
|
6
30
|
-------------------
|
7
31
|
### Improvements
|
data/README.md
CHANGED
@@ -82,6 +82,7 @@ API
|
|
82
82
|
- `sparc?`
|
83
83
|
- `ppc64?`
|
84
84
|
- `ppc64le?`
|
85
|
+
- `powerpc?`
|
85
86
|
|
86
87
|
#### Examples
|
87
88
|
```ruby
|
@@ -249,6 +250,31 @@ class Chef
|
|
249
250
|
end
|
250
251
|
```
|
251
252
|
|
253
|
+
### Init
|
254
|
+
- `systemd?` - detect if init system is systemd
|
255
|
+
- `upstart?` - detect if init system is upstart
|
256
|
+
- `runit?` - detect if init system is runit
|
257
|
+
|
258
|
+
#### Examples
|
259
|
+
```ruby
|
260
|
+
systemd_service 'my-service' do
|
261
|
+
description 'My Service'
|
262
|
+
install do
|
263
|
+
wanted_by 'multi-user.target'
|
264
|
+
end
|
265
|
+
service do
|
266
|
+
exec_start '/usr/bin/myserviced'
|
267
|
+
end
|
268
|
+
action [:create, :enable, :start]
|
269
|
+
only_if { systemd? }
|
270
|
+
end
|
271
|
+
|
272
|
+
cookbook_file '/etc/init/my-service.conf' do
|
273
|
+
source 'my-service.conf'
|
274
|
+
only_if { upstart? }
|
275
|
+
end
|
276
|
+
```
|
277
|
+
|
252
278
|
### IP
|
253
279
|
- `best_ip_for` - determine the best IP address for the given "other" node, preferring local IP addresses over public ones.
|
254
280
|
|
@@ -296,6 +322,9 @@ node.deep_fetch('apache2', 'config', 'root') => node['apache2']['config']['root'
|
|
296
322
|
- `aix?`
|
297
323
|
- `smartos?`
|
298
324
|
- `omnios?`
|
325
|
+
- `raspbian?`
|
326
|
+
- `nexus?`
|
327
|
+
- `ios_xr?`
|
299
328
|
|
300
329
|
There are also a series of dynamically defined matchers that map named operating system release versions and comparison operators in the form "#{platform}\_#{operator}\_#{name}?". For example:
|
301
330
|
|
@@ -334,6 +363,7 @@ end
|
|
334
363
|
- `slackware?`
|
335
364
|
- `suse?`
|
336
365
|
- `windows?`
|
366
|
+
- `wrlinux?`
|
337
367
|
|
338
368
|
#### Examples
|
339
369
|
```ruby
|
@@ -404,6 +434,7 @@ end
|
|
404
434
|
- `lxc?`
|
405
435
|
- `virtualbox?`
|
406
436
|
- `vmware?`
|
437
|
+
- `openvz?`
|
407
438
|
|
408
439
|
#### Examples
|
409
440
|
```ruby
|
data/lib/chef/sugar.rb
CHANGED
@@ -26,7 +26,7 @@ class Chef
|
|
26
26
|
#
|
27
27
|
def _64_bit?(node)
|
28
28
|
%w(amd64 x86_64 ppc64 ppc64le s390x ia64 sparc64 aarch64 arch64 arm64 sun4v sun4u)
|
29
|
-
.include?(node['kernel']['machine'])
|
29
|
+
.include?(node['kernel']['machine']) || ( node['kernel']['bits'] == '64' )
|
30
30
|
end
|
31
31
|
|
32
32
|
#
|
@@ -88,6 +88,16 @@ class Chef
|
|
88
88
|
%w(ppc64le)
|
89
89
|
.include?(node['kernel']['machine'])
|
90
90
|
end
|
91
|
+
|
92
|
+
#
|
93
|
+
# Determine if the current architecture is PowerPC
|
94
|
+
#
|
95
|
+
# @return [Boolean]
|
96
|
+
#
|
97
|
+
def powerpc?(node)
|
98
|
+
%w(powerpc)
|
99
|
+
.include?(node['kernel']['machine'])
|
100
|
+
end
|
91
101
|
end
|
92
102
|
|
93
103
|
module DSL
|
@@ -96,7 +106,9 @@ class Chef
|
|
96
106
|
|
97
107
|
# @see Chef::Sugar::Architecture#_32_bit?
|
98
108
|
def _32_bit?; Chef::Sugar::Architecture._32_bit?(node); end
|
99
|
-
|
109
|
+
|
110
|
+
# @see Chef::Sugar::Architecture#intel?
|
111
|
+
def i386?; Chef::Sugar::Architecture.i386?(node); end
|
100
112
|
|
101
113
|
# @see Chef::Sugar::Architecture#intel?
|
102
114
|
def intel?; Chef::Sugar::Architecture.intel?(node); end
|
@@ -109,6 +121,9 @@ class Chef
|
|
109
121
|
|
110
122
|
# @see Chef::Sugar::Architecture#ppc64le?
|
111
123
|
def ppc64le?; Chef::Sugar::Architecture.ppc64le?(node); end
|
124
|
+
|
125
|
+
# @see Chef::Sugar::Architecture#powerpc?
|
126
|
+
def powerpc?; Chef::Sugar::Architecture.powerpc?(node); end
|
112
127
|
end
|
113
128
|
end
|
114
129
|
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Nathan Williams <nath.e.will@gmail.com>
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
class Chef
|
18
|
+
module Sugar
|
19
|
+
module Init
|
20
|
+
extend self
|
21
|
+
|
22
|
+
#
|
23
|
+
# Determine if the current init system is systemd.
|
24
|
+
#
|
25
|
+
# @return [Boolean]
|
26
|
+
#
|
27
|
+
def systemd?(node)
|
28
|
+
IO.read('/proc/1/comm').chomp == 'systemd'
|
29
|
+
end
|
30
|
+
|
31
|
+
#
|
32
|
+
# Determine if the current init system is upstart.
|
33
|
+
#
|
34
|
+
# @return [Boolean]
|
35
|
+
#
|
36
|
+
def upstart?(node)
|
37
|
+
File.executable?('/sbin/initctl')
|
38
|
+
end
|
39
|
+
|
40
|
+
#
|
41
|
+
# Determine if the current init system is runit.
|
42
|
+
#
|
43
|
+
# @return [Boolean]
|
44
|
+
#
|
45
|
+
def runit?(node)
|
46
|
+
File.executable?('/sbin/runit-init')
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
module DSL
|
51
|
+
# @see Chef::Sugar::Init#systemd?
|
52
|
+
def systemd?; Chef::Sugar::Init.systemd?(node); end
|
53
|
+
|
54
|
+
# @see Chef::Sugar::Init#upstart?
|
55
|
+
def upstart?; Chef::Sugar::Init.upstart?(node); end
|
56
|
+
|
57
|
+
# @see Chef::Sugar::Init#runit?
|
58
|
+
def runit?; Chef::Sugar::Init.runit?(node); end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/lib/chef/sugar/platform.rb
CHANGED
@@ -112,6 +112,17 @@ class Chef
|
|
112
112
|
node['platform'] == 'ubuntu'
|
113
113
|
end
|
114
114
|
|
115
|
+
#
|
116
|
+
# Determine if the current node is debian (platform, not platform_family).
|
117
|
+
#
|
118
|
+
# @param [Chef::Node] node
|
119
|
+
#
|
120
|
+
# @return [Boolean]
|
121
|
+
#
|
122
|
+
def debian_platform?(node)
|
123
|
+
node['platform'] == 'debian'
|
124
|
+
end
|
125
|
+
|
115
126
|
#
|
116
127
|
# Determine if the current node is amazon linux.
|
117
128
|
#
|
@@ -171,6 +182,17 @@ class Chef
|
|
171
182
|
end
|
172
183
|
alias_method :redhat_enterprise?, :redhat_enterprise_linux?
|
173
184
|
|
185
|
+
#
|
186
|
+
# Determine if the current node is fedora (platform, not platform_family).
|
187
|
+
#
|
188
|
+
# @param [Chef::Node] node
|
189
|
+
#
|
190
|
+
# @return [Boolean]
|
191
|
+
#
|
192
|
+
def fedora_platform?(node)
|
193
|
+
node['platform'] == 'fedora'
|
194
|
+
end
|
195
|
+
|
174
196
|
#
|
175
197
|
# Determine if the current node is solaris2
|
176
198
|
#
|
@@ -215,6 +237,39 @@ class Chef
|
|
215
237
|
def omnios?(node)
|
216
238
|
node['platform'] == 'omnios'
|
217
239
|
end
|
240
|
+
|
241
|
+
#
|
242
|
+
# Determine if the current node is raspbian
|
243
|
+
#
|
244
|
+
# @param [Chef::Node] node
|
245
|
+
#
|
246
|
+
# @return [Boolean]
|
247
|
+
#
|
248
|
+
def raspbian?(node)
|
249
|
+
node['platform'] == 'raspbian'
|
250
|
+
end
|
251
|
+
|
252
|
+
#
|
253
|
+
# Determine if the current node is a Cisco nexus device
|
254
|
+
#
|
255
|
+
# @param [Chef::Node] node
|
256
|
+
#
|
257
|
+
# @return [Boolean]
|
258
|
+
#
|
259
|
+
def nexus?(node)
|
260
|
+
node['platform'] == 'nexus'
|
261
|
+
end
|
262
|
+
|
263
|
+
#
|
264
|
+
# Determine if the current node is a Cisco IOS-XR device
|
265
|
+
#
|
266
|
+
# @param [Chef::Node] node
|
267
|
+
#
|
268
|
+
# @return [Boolean]
|
269
|
+
#
|
270
|
+
def ios_xr?(node)
|
271
|
+
node['platform'] == 'ios_xr'
|
272
|
+
end
|
218
273
|
end
|
219
274
|
|
220
275
|
module DSL
|
@@ -145,6 +145,17 @@ class Chef
|
|
145
145
|
node['platform_family'] == 'windows'
|
146
146
|
end
|
147
147
|
|
148
|
+
#
|
149
|
+
# Determine if the current node is a member of the wrlinux family.
|
150
|
+
#
|
151
|
+
# @param [Chef::Node] node
|
152
|
+
#
|
153
|
+
# @return [Boolean]
|
154
|
+
#
|
155
|
+
def wrlinux?(node)
|
156
|
+
node['platform_family'] == 'wrlinux'
|
157
|
+
end
|
158
|
+
|
148
159
|
#
|
149
160
|
# Determine if the current system is a linux derivative
|
150
161
|
#
|
@@ -161,6 +172,7 @@ class Chef
|
|
161
172
|
rhel
|
162
173
|
slackware
|
163
174
|
suse
|
175
|
+
wrlinux
|
164
176
|
).include?(node['platform_family'])
|
165
177
|
end
|
166
178
|
end
|
data/lib/chef/sugar/version.rb
CHANGED
@@ -70,6 +70,19 @@ class Chef
|
|
70
70
|
def vmware?(node)
|
71
71
|
node.key?('virtualization') && node['virtualization']['system'] == 'vmware'
|
72
72
|
end
|
73
|
+
|
74
|
+
#
|
75
|
+
# Determine if the current node is running under openvz.
|
76
|
+
#
|
77
|
+
# @param [Chef::Node] node
|
78
|
+
#
|
79
|
+
# @return [Boolean]
|
80
|
+
# true if the machine is currently running under openvz, false
|
81
|
+
# otherwise
|
82
|
+
#
|
83
|
+
def openvz?(node)
|
84
|
+
node.key?('virtualization') && node['virtualization']['system'] == 'openvz'
|
85
|
+
end
|
73
86
|
end
|
74
87
|
|
75
88
|
module DSL
|
@@ -84,6 +97,9 @@ class Chef
|
|
84
97
|
|
85
98
|
# @see Chef::Sugar::Virtualization#vmware?
|
86
99
|
def vmware?; Chef::Sugar::Virtualization.vmware?(node); end
|
100
|
+
|
101
|
+
# @see Chef::Sugar::Virtualization#openvz?
|
102
|
+
def openvz?; Chef::Sugar::Virtualization.openvz?(node); end
|
87
103
|
end
|
88
104
|
end
|
89
105
|
end
|
@@ -14,6 +14,16 @@ describe Chef::Sugar::Architecture do
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
it 'returns true when ohai provides the bittiness' do
|
18
|
+
node = { 'kernel' => { 'bits' => '64' } }
|
19
|
+
expect(described_class._64_bit?(node)).to be true
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'returns false when ohai provides the bittiness' do
|
23
|
+
node = { 'kernel' => { 'bits' => '32' } }
|
24
|
+
expect(described_class._64_bit?(node)).to be false
|
25
|
+
end
|
26
|
+
|
17
27
|
it 'returns false when the system is not 64 bit' do
|
18
28
|
node = { 'kernel' => { 'machine' => 'i386' } }
|
19
29
|
expect(described_class._64_bit?(node)).to be false
|
@@ -62,6 +72,12 @@ describe Chef::Sugar::Architecture do
|
|
62
72
|
end
|
63
73
|
end
|
64
74
|
|
75
|
+
describe '#powerpc?' do
|
76
|
+
it 'returns true when the system is IBM POWER or powerpc' do
|
77
|
+
node = { 'kernel' => { 'machine' => 'powerpc' } }
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
65
81
|
describe '#sparc?' do
|
66
82
|
it 'returns true when the system is SPARC sun4u' do
|
67
83
|
node = { 'kernel' => { 'machine' => 'sun4u' } }
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Chef::Sugar::Init do
|
4
|
+
it_behaves_like 'a chef sugar'
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
allow(IO).to receive(:read)
|
8
|
+
.with("/proc/1/comm")
|
9
|
+
.and_return("init")
|
10
|
+
allow(File).to receive(:executable?)
|
11
|
+
.with("/sbin/initctl")
|
12
|
+
.and_return(false)
|
13
|
+
allow(File).to receive(:executable?)
|
14
|
+
.with("/sbin/runit-init")
|
15
|
+
.and_return(false)
|
16
|
+
end
|
17
|
+
|
18
|
+
describe '#systemd?' do
|
19
|
+
it 'is true when /proc/1/comm is systemd' do
|
20
|
+
allow(IO).to receive(:read)
|
21
|
+
.with("/proc/1/comm")
|
22
|
+
.and_return("systemd")
|
23
|
+
|
24
|
+
node = {}
|
25
|
+
expect(described_class.systemd?(node)).to be true
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'is false when /proc/1/comm is not systemd' do
|
29
|
+
node = {}
|
30
|
+
expect(described_class.systemd?(node)).to be false
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe '#upstart?' do
|
35
|
+
it 'is true when /sbin/initctl is executable' do
|
36
|
+
allow(File).to receive(:executable?)
|
37
|
+
.with("/sbin/initctl")
|
38
|
+
.and_return(true)
|
39
|
+
|
40
|
+
node = {}
|
41
|
+
expect(described_class.upstart?(node)).to be true
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'is false when /sbin/initctl is not executable' do
|
45
|
+
node = {}
|
46
|
+
expect(described_class.upstart?(node)).to be false
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe '#runit?' do
|
51
|
+
it 'is true when /sbin/runit-init is executable' do
|
52
|
+
allow(File).to receive(:executable?)
|
53
|
+
.with("/sbin/runit-init")
|
54
|
+
.and_return(true)
|
55
|
+
|
56
|
+
node = {}
|
57
|
+
expect(described_class.runit?(node)).to be true
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'is false when /sbin/runit-init is not executable' do
|
61
|
+
node = {}
|
62
|
+
expect(described_class.runit?(node)).to be false
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -135,6 +135,18 @@ describe Chef::Sugar::PlatformFamily do
|
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
138
|
+
describe '#wrlinux?' do
|
139
|
+
it 'returns true when the platform_family is wrlinux' do
|
140
|
+
node = { 'platform_family' => 'wrlinux' }
|
141
|
+
expect(described_class.wrlinux?(node)).to be true
|
142
|
+
end
|
143
|
+
|
144
|
+
it 'returns false when the platform_family is not wrlinux' do
|
145
|
+
node = { 'platform_family' => 'debian' }
|
146
|
+
expect(described_class.wrlinux?(node)).to be false
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
138
150
|
describe '#linux?' do
|
139
151
|
it 'returns true when the platform_family is Debian' do
|
140
152
|
node = { 'platform_family' => 'debian' }
|
@@ -146,6 +158,11 @@ describe Chef::Sugar::PlatformFamily do
|
|
146
158
|
expect(described_class.linux?(node)).to be true
|
147
159
|
end
|
148
160
|
|
161
|
+
it 'returns true when the platform_family is wrlinux' do
|
162
|
+
node = { 'platform_family' => 'wrlinux' }
|
163
|
+
expect(described_class.linux?(node)).to be true
|
164
|
+
end
|
165
|
+
|
149
166
|
it 'returns false when the platform_family is Windows' do
|
150
167
|
node = { 'platform_family' => 'windows' }
|
151
168
|
expect(described_class.linux?(node)).to be false
|
@@ -135,6 +135,42 @@ describe Chef::Sugar::Platform do
|
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
138
|
+
describe '#raspbian?' do
|
139
|
+
it 'returns true when platform is raspbian' do
|
140
|
+
node = { 'platform' => 'raspbian' }
|
141
|
+
expect(described_class.raspbian?(node)).to be true
|
142
|
+
end
|
143
|
+
|
144
|
+
it 'returns false when the platform is not raspbian' do
|
145
|
+
node = { 'platform' => 'windows' }
|
146
|
+
expect(described_class.raspbian?(node)).to be false
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
describe '#nexus' do
|
151
|
+
it 'returns true when the platform is nexus' do
|
152
|
+
node = { 'platform' => 'nexus' }
|
153
|
+
expect(described_class.nexus?(node)).to be true
|
154
|
+
end
|
155
|
+
|
156
|
+
it 'returns false when the platform is not nexus' do
|
157
|
+
node = { 'platform' => 'windows' }
|
158
|
+
expect(described_class.nexus?(node)).to be false
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
describe '#ios_xr' do
|
163
|
+
it 'returns true when the platform is ios_xr' do
|
164
|
+
node = { 'platform' => 'ios_xr' }
|
165
|
+
expect(described_class.ios_xr?(node)).to be true
|
166
|
+
end
|
167
|
+
|
168
|
+
it 'returns false when the platform is not ios_xr' do
|
169
|
+
node = { 'platform' => 'windows' }
|
170
|
+
expect(described_class.ios_xr?(node)).to be false
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
138
174
|
context 'dynamic matchers' do
|
139
175
|
describe '#ubuntu_after_lucid?' do
|
140
176
|
it 'returns true when the version is later than 10.04' do
|
@@ -70,4 +70,21 @@ describe Chef::Sugar::Virtualization do
|
|
70
70
|
expect(described_class.vmware?(node)).to be false
|
71
71
|
end
|
72
72
|
end
|
73
|
+
|
74
|
+
describe '#openvz?' do
|
75
|
+
it 'returns true when the machine is under openvz' do
|
76
|
+
node = { 'virtualization' => { 'system' => 'openvz' } }
|
77
|
+
expect(described_class.openvz?(node)).to be true
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'returns false when the virtual machine is not under openvz' do
|
81
|
+
node = { 'virtualization' => { 'system' => 'kvm' } }
|
82
|
+
expect(described_class.openvz?(node)).to be false
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'returns false when the machine is not virtual' do
|
86
|
+
node = {}
|
87
|
+
expect(described_class.openvz?(node)).to be false
|
88
|
+
end
|
89
|
+
end
|
73
90
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-sugar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seth Vargo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -110,6 +110,7 @@ files:
|
|
110
110
|
- lib/chef/sugar/data_bag.rb
|
111
111
|
- lib/chef/sugar/docker.rb
|
112
112
|
- lib/chef/sugar/filters.rb
|
113
|
+
- lib/chef/sugar/init.rb
|
113
114
|
- lib/chef/sugar/ip.rb
|
114
115
|
- lib/chef/sugar/kernel.rb
|
115
116
|
- lib/chef/sugar/node.rb
|
@@ -133,6 +134,7 @@ files:
|
|
133
134
|
- spec/unit/chef/sugar/core_extensions/string_spec.rb
|
134
135
|
- spec/unit/chef/sugar/data_bag_spec.rb
|
135
136
|
- spec/unit/chef/sugar/docker_spec.rb
|
137
|
+
- spec/unit/chef/sugar/init_spec.rb
|
136
138
|
- spec/unit/chef/sugar/ip_spec.rb
|
137
139
|
- spec/unit/chef/sugar/kernel_spec.rb
|
138
140
|
- spec/unit/chef/sugar/node_spec.rb
|
@@ -164,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
166
|
version: '0'
|
165
167
|
requirements: []
|
166
168
|
rubyforge_project:
|
167
|
-
rubygems_version: 2.2.
|
169
|
+
rubygems_version: 2.2.2
|
168
170
|
signing_key:
|
169
171
|
specification_version: 4
|
170
172
|
summary: A collection of helper methods and modules that make working with Chef recipes
|
@@ -180,6 +182,7 @@ test_files:
|
|
180
182
|
- spec/unit/chef/sugar/core_extensions/string_spec.rb
|
181
183
|
- spec/unit/chef/sugar/data_bag_spec.rb
|
182
184
|
- spec/unit/chef/sugar/docker_spec.rb
|
185
|
+
- spec/unit/chef/sugar/init_spec.rb
|
183
186
|
- spec/unit/chef/sugar/ip_spec.rb
|
184
187
|
- spec/unit/chef/sugar/kernel_spec.rb
|
185
188
|
- spec/unit/chef/sugar/node_spec.rb
|