chef-utils 15.8.23 → 15.9.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chef-utils/dsl/architecture.rb +30 -8
- data/lib/chef-utils/dsl/cloud.rb +31 -22
- data/lib/chef-utils/dsl/introspection.rb +11 -4
- data/lib/chef-utils/dsl/os.rb +6 -4
- data/lib/chef-utils/dsl/path_sanity.rb +1 -0
- data/lib/chef-utils/dsl/platform.rb +56 -28
- data/lib/chef-utils/dsl/platform_family.rb +59 -33
- data/lib/chef-utils/dsl/service.rb +10 -0
- data/lib/chef-utils/dsl/train_helpers.rb +2 -2
- data/lib/chef-utils/dsl/windows.rb +13 -8
- data/lib/chef-utils/version.rb +1 -1
- data/spec/unit/dsl/cloud_spec.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b5f26cfc5632af99806129c59a02783c042b563026b67f3e96f7ca687649326
|
4
|
+
data.tar.gz: 5ae59b9ee97304fdce0c2b22a8ac92e89cddf70fbac5862e4d4389765bde854b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1d4be454d64efac5bec779357929b5f1fc5399da1ebdb0061a6c398374c63827d727458108b1fbfe384d6fdcf02f30f54c119dd9a1b3a73b8e00ec81e9e63a8
|
7
|
+
data.tar.gz: 70f1b73ff645783185f267f085a03e214ed1fc1df5be0a4af5064881c89347a212bcd61b67095ed7f8022e9a6fad23ff7ed0a0296d67c144369730af63119268
|
@@ -22,7 +22,9 @@ module ChefUtils
|
|
22
22
|
module Architecture
|
23
23
|
include Internal
|
24
24
|
|
25
|
-
# Determine if the current architecture is 64-bit
|
25
|
+
# Determine if the current architecture is 64-bit.
|
26
|
+
#
|
27
|
+
# @since 15.5
|
26
28
|
#
|
27
29
|
# @return [Boolean]
|
28
30
|
#
|
@@ -31,7 +33,9 @@ module ChefUtils
|
|
31
33
|
.include?(node["kernel"]["machine"])
|
32
34
|
end
|
33
35
|
|
34
|
-
# Determine if the current architecture is 32-bit
|
36
|
+
# Determine if the current architecture is 32-bit.
|
37
|
+
#
|
38
|
+
# @since 15.5
|
35
39
|
#
|
36
40
|
# @return [Boolean]
|
37
41
|
#
|
@@ -39,7 +43,9 @@ module ChefUtils
|
|
39
43
|
!_64_bit?(node)
|
40
44
|
end
|
41
45
|
|
42
|
-
# Determine if the current architecture is i386
|
46
|
+
# Determine if the current architecture is i386.
|
47
|
+
#
|
48
|
+
# @since 15.5
|
43
49
|
#
|
44
50
|
# @return [Boolean]
|
45
51
|
#
|
@@ -49,6 +55,8 @@ module ChefUtils
|
|
49
55
|
|
50
56
|
# Determine if the current architecture is Intel.
|
51
57
|
#
|
58
|
+
# @since 15.5
|
59
|
+
#
|
52
60
|
# @return [Boolean]
|
53
61
|
#
|
54
62
|
def intel?(node = __getnode)
|
@@ -57,13 +65,17 @@ module ChefUtils
|
|
57
65
|
|
58
66
|
# Determine if the current architecture is SPARC.
|
59
67
|
#
|
68
|
+
# @since 15.5
|
69
|
+
#
|
60
70
|
# @return [Boolean]
|
61
71
|
#
|
62
72
|
def sparc?(node = __getnode)
|
63
73
|
%w{sun4u sun4v}.include?(node["kernel"]["machine"])
|
64
74
|
end
|
65
75
|
|
66
|
-
# Determine if the current architecture is PowerPC 64bit Big Endian
|
76
|
+
# Determine if the current architecture is PowerPC 64bit Big Endian.
|
77
|
+
#
|
78
|
+
# @since 15.5
|
67
79
|
#
|
68
80
|
# @return [Boolean]
|
69
81
|
#
|
@@ -71,7 +83,9 @@ module ChefUtils
|
|
71
83
|
%w{ppc64}.include?(node["kernel"]["machine"])
|
72
84
|
end
|
73
85
|
|
74
|
-
# Determine if the current architecture is PowerPC 64bit Little Endian
|
86
|
+
# Determine if the current architecture is PowerPC 64bit Little Endian.
|
87
|
+
#
|
88
|
+
# @since 15.5
|
75
89
|
#
|
76
90
|
# @return [Boolean]
|
77
91
|
#
|
@@ -81,13 +95,17 @@ module ChefUtils
|
|
81
95
|
|
82
96
|
# Determine if the current architecture is PowerPC.
|
83
97
|
#
|
98
|
+
# @since 15.5
|
99
|
+
#
|
84
100
|
# @return [Boolean]
|
85
101
|
#
|
86
102
|
def powerpc?(node = __getnode)
|
87
103
|
%w{powerpc}.include?(node["kernel"]["machine"])
|
88
104
|
end
|
89
105
|
|
90
|
-
# Determine if the current architecture is 32-bit ARM
|
106
|
+
# Determine if the current architecture is 32-bit ARM.
|
107
|
+
#
|
108
|
+
# @since 15.5
|
91
109
|
#
|
92
110
|
# @return [Boolean]
|
93
111
|
#
|
@@ -95,7 +113,9 @@ module ChefUtils
|
|
95
113
|
%w{armhf}.include?(node["kernel"]["machine"])
|
96
114
|
end
|
97
115
|
|
98
|
-
# Determine if the current architecture is s390x
|
116
|
+
# Determine if the current architecture is s390x.
|
117
|
+
#
|
118
|
+
# @since 15.5
|
99
119
|
#
|
100
120
|
# @return [Boolean]
|
101
121
|
#
|
@@ -103,7 +123,9 @@ module ChefUtils
|
|
103
123
|
%w{s390x}.include?(node["kernel"]["machine"])
|
104
124
|
end
|
105
125
|
|
106
|
-
# Determine if the current architecture is s390
|
126
|
+
# Determine if the current architecture is s390.
|
127
|
+
#
|
128
|
+
# @since 15.5
|
107
129
|
#
|
108
130
|
# @return [Boolean]
|
109
131
|
#
|
data/lib/chef-utils/dsl/cloud.rb
CHANGED
@@ -24,17 +24,20 @@ module ChefUtils
|
|
24
24
|
|
25
25
|
# Determine if the current node is "in the cloud".
|
26
26
|
#
|
27
|
-
# @param [Chef::Node] node
|
27
|
+
# @param [Chef::Node] node the node to check
|
28
|
+
# @since 15.8
|
28
29
|
#
|
29
30
|
# @return [Boolean]
|
30
31
|
#
|
31
32
|
def cloud?(node = __getnode)
|
32
|
-
|
33
|
+
# cloud is always present, but nil if not on a cloud
|
34
|
+
!node["cloud"].nil?
|
33
35
|
end
|
34
36
|
|
35
|
-
# Return true if the current current node is in EC2
|
37
|
+
# Return true if the current current node is in EC2.
|
36
38
|
#
|
37
|
-
# @param [Chef::Node] node
|
39
|
+
# @param [Chef::Node] node the node to check
|
40
|
+
# @since 15.8
|
38
41
|
#
|
39
42
|
# @return [Boolean]
|
40
43
|
#
|
@@ -42,9 +45,10 @@ module ChefUtils
|
|
42
45
|
node.key?("ec2")
|
43
46
|
end
|
44
47
|
|
45
|
-
# Return true if the current current node is in GCE
|
48
|
+
# Return true if the current current node is in GCE.
|
46
49
|
#
|
47
|
-
# @param [Chef::Node] node
|
50
|
+
# @param [Chef::Node] node the node to check
|
51
|
+
# @since 15.8
|
48
52
|
#
|
49
53
|
# @return [Boolean]
|
50
54
|
#
|
@@ -52,9 +56,10 @@ module ChefUtils
|
|
52
56
|
node.key?("gce")
|
53
57
|
end
|
54
58
|
|
55
|
-
# Return true if the current current node is in Rackspace
|
59
|
+
# Return true if the current current node is in Rackspace.
|
56
60
|
#
|
57
|
-
# @param [Chef::Node] node
|
61
|
+
# @param [Chef::Node] node the node to check
|
62
|
+
# @since 15.8
|
58
63
|
#
|
59
64
|
# @return [Boolean]
|
60
65
|
#
|
@@ -62,9 +67,10 @@ module ChefUtils
|
|
62
67
|
node.key?("rackspace")
|
63
68
|
end
|
64
69
|
|
65
|
-
# Return true if the current current node is in Eucalyptus
|
70
|
+
# Return true if the current current node is in Eucalyptus.
|
66
71
|
#
|
67
|
-
# @param [Chef::Node] node
|
72
|
+
# @param [Chef::Node] node the node to check
|
73
|
+
# @since 15.8
|
68
74
|
#
|
69
75
|
# @return [Boolean]
|
70
76
|
#
|
@@ -74,9 +80,10 @@ module ChefUtils
|
|
74
80
|
# chef-sugar backcompat method
|
75
81
|
alias_method :euca?, :eucalyptus?
|
76
82
|
|
77
|
-
# Return true if the current current node is in Linode
|
83
|
+
# Return true if the current current node is in Linode.
|
78
84
|
#
|
79
|
-
# @param [Chef::Node] node
|
85
|
+
# @param [Chef::Node] node the node to check
|
86
|
+
# @since 15.8
|
80
87
|
#
|
81
88
|
# @return [Boolean]
|
82
89
|
#
|
@@ -84,9 +91,10 @@ module ChefUtils
|
|
84
91
|
node.key?("linode")
|
85
92
|
end
|
86
93
|
|
87
|
-
# Return true if the current current node is in
|
94
|
+
# Return true if the current current node is in OpenStack.
|
88
95
|
#
|
89
|
-
# @param [Chef::Node] node
|
96
|
+
# @param [Chef::Node] node the node to check
|
97
|
+
# @since 15.8
|
90
98
|
#
|
91
99
|
# @return [Boolean]
|
92
100
|
#
|
@@ -94,9 +102,10 @@ module ChefUtils
|
|
94
102
|
node.key?("openstack")
|
95
103
|
end
|
96
104
|
|
97
|
-
# Return true if the current current node is in Azure
|
105
|
+
# Return true if the current current node is in Azure.
|
98
106
|
#
|
99
|
-
# @param [Chef::Node] node
|
107
|
+
# @param [Chef::Node] node the node to check
|
108
|
+
# @since 15.8
|
100
109
|
#
|
101
110
|
# @return [Boolean]
|
102
111
|
#
|
@@ -104,10 +113,10 @@ module ChefUtils
|
|
104
113
|
node.key?("azure")
|
105
114
|
end
|
106
115
|
|
107
|
-
# Return true if the current current node is in DigitalOcean
|
116
|
+
# Return true if the current current node is in DigitalOcean.
|
108
117
|
#
|
109
|
-
# @param [Chef::Node] node
|
110
|
-
#
|
118
|
+
# @param [Chef::Node] node the node to check
|
119
|
+
# @since 15.8
|
111
120
|
#
|
112
121
|
# @return [Boolean]
|
113
122
|
#
|
@@ -117,10 +126,10 @@ module ChefUtils
|
|
117
126
|
# chef-sugar backcompat method
|
118
127
|
alias_method :digitalocean?, :digital_ocean?
|
119
128
|
|
120
|
-
# Return true if the current current node is in SoftLayer
|
129
|
+
# Return true if the current current node is in SoftLayer.
|
121
130
|
#
|
122
|
-
# @param [Chef::Node] node
|
123
|
-
#
|
131
|
+
# @param [Chef::Node] node the node to check
|
132
|
+
# @since 15.8
|
124
133
|
#
|
125
134
|
# @return [Boolean]
|
126
135
|
#
|
@@ -30,7 +30,8 @@ module ChefUtils
|
|
30
30
|
|
31
31
|
# Determine if the node is a docker container.
|
32
32
|
#
|
33
|
-
# @param [Chef::Node] node
|
33
|
+
# @param [Chef::Node] node the node to check
|
34
|
+
# @since 15.5
|
34
35
|
#
|
35
36
|
# @return [Boolean]
|
36
37
|
#
|
@@ -42,7 +43,8 @@ module ChefUtils
|
|
42
43
|
|
43
44
|
# Determine if the node uses the systemd init system.
|
44
45
|
#
|
45
|
-
# @param [Chef::Node] node
|
46
|
+
# @param [Chef::Node] node the node to check
|
47
|
+
# @since 15.5
|
46
48
|
#
|
47
49
|
# @return [Boolean]
|
48
50
|
#
|
@@ -52,7 +54,8 @@ module ChefUtils
|
|
52
54
|
|
53
55
|
# Determine if the node is running in Test Kitchen.
|
54
56
|
#
|
55
|
-
# @param [Chef::Node] node
|
57
|
+
# @param [Chef::Node] node the node to check
|
58
|
+
# @since 15.5
|
56
59
|
#
|
57
60
|
# @return [Boolean]
|
58
61
|
#
|
@@ -62,7 +65,8 @@ module ChefUtils
|
|
62
65
|
|
63
66
|
# Determine if the node is running in a CI system that sets the CI env var.
|
64
67
|
#
|
65
|
-
# @param [Chef::Node] node
|
68
|
+
# @param [Chef::Node] node the node to check
|
69
|
+
# @since 15.5
|
66
70
|
#
|
67
71
|
# @return [Boolean]
|
68
72
|
#
|
@@ -73,6 +77,7 @@ module ChefUtils
|
|
73
77
|
# Determine if the a systemd service unit is present on the system.
|
74
78
|
#
|
75
79
|
# @param [String] svc_name
|
80
|
+
# @since 15.5
|
76
81
|
#
|
77
82
|
# @return [Boolean]
|
78
83
|
#
|
@@ -87,6 +92,7 @@ module ChefUtils
|
|
87
92
|
# Determine if the a systemd unit of any type is present on the system.
|
88
93
|
#
|
89
94
|
# @param [String] svc_name
|
95
|
+
# @since 15.5
|
90
96
|
#
|
91
97
|
# @return [Boolean]
|
92
98
|
#
|
@@ -100,6 +106,7 @@ module ChefUtils
|
|
100
106
|
# Determine if the current node includes the given recipe name.
|
101
107
|
#
|
102
108
|
# @param [String] recipe_name
|
109
|
+
# @since 15.8
|
103
110
|
#
|
104
111
|
# @return [Boolean]
|
105
112
|
#
|
data/lib/chef-utils/dsl/os.rb
CHANGED
@@ -29,9 +29,10 @@ module ChefUtils
|
|
29
29
|
# only the platform helper should be added.
|
30
30
|
#
|
31
31
|
|
32
|
-
# Determine if the current node is
|
32
|
+
# Determine if the current node is Linux.
|
33
33
|
#
|
34
|
-
# @param [Chef::Node] node
|
34
|
+
# @param [Chef::Node] node the node to check
|
35
|
+
# @since 15.5
|
35
36
|
#
|
36
37
|
# @return [Boolean]
|
37
38
|
#
|
@@ -39,9 +40,10 @@ module ChefUtils
|
|
39
40
|
node["os"] == "linux"
|
40
41
|
end
|
41
42
|
|
42
|
-
# Determine if the current node is
|
43
|
+
# Determine if the current node is Darwin.
|
43
44
|
#
|
44
|
-
# @param [Chef::Node] node
|
45
|
+
# @param [Chef::Node] node the node to check
|
46
|
+
# @since 15.5
|
45
47
|
#
|
46
48
|
# @return [Boolean]
|
47
49
|
#
|
@@ -29,7 +29,8 @@ module ChefUtils
|
|
29
29
|
|
30
30
|
# Determine if the current node is linux mint.
|
31
31
|
#
|
32
|
-
# @param [Chef::Node] node
|
32
|
+
# @param [Chef::Node] node the node to check
|
33
|
+
# @since 15.5
|
33
34
|
#
|
34
35
|
# @return [Boolean]
|
35
36
|
#
|
@@ -45,7 +46,8 @@ module ChefUtils
|
|
45
46
|
|
46
47
|
# Determine if the current node is Ubuntu.
|
47
48
|
#
|
48
|
-
# @param [Chef::Node] node
|
49
|
+
# @param [Chef::Node] node the node to check
|
50
|
+
# @since 15.5
|
49
51
|
#
|
50
52
|
# @return [Boolean]
|
51
53
|
#
|
@@ -57,7 +59,8 @@ module ChefUtils
|
|
57
59
|
|
58
60
|
# Determine if the current node is Raspbian.
|
59
61
|
#
|
60
|
-
# @param [Chef::Node] node
|
62
|
+
# @param [Chef::Node] node the node to check
|
63
|
+
# @since 15.5
|
61
64
|
#
|
62
65
|
# @return [Boolean]
|
63
66
|
#
|
@@ -69,7 +72,8 @@ module ChefUtils
|
|
69
72
|
|
70
73
|
# Determine if the current node is Debian.
|
71
74
|
#
|
72
|
-
# @param [Chef::Node] node
|
75
|
+
# @param [Chef::Node] node the node to check
|
76
|
+
# @since 15.5
|
73
77
|
#
|
74
78
|
# @return [Boolean]
|
75
79
|
#
|
@@ -79,7 +83,8 @@ module ChefUtils
|
|
79
83
|
|
80
84
|
# Determine if the current node is Amazon Linux.
|
81
85
|
#
|
82
|
-
# @param [Chef::Node] node
|
86
|
+
# @param [Chef::Node] node the node to check
|
87
|
+
# @since 15.5
|
83
88
|
#
|
84
89
|
# @return [Boolean]
|
85
90
|
#
|
@@ -89,7 +94,8 @@ module ChefUtils
|
|
89
94
|
|
90
95
|
# Determine if the current node is Red Hat Enterprise Linux.
|
91
96
|
#
|
92
|
-
# @param [Chef::Node] node
|
97
|
+
# @param [Chef::Node] node the node to check
|
98
|
+
# @since 15.5
|
93
99
|
#
|
94
100
|
# @return [Boolean]
|
95
101
|
#
|
@@ -105,7 +111,8 @@ module ChefUtils
|
|
105
111
|
|
106
112
|
# Determine if the current node is CentOS.
|
107
113
|
#
|
108
|
-
# @param [Chef::Node] node
|
114
|
+
# @param [Chef::Node] node the node to check
|
115
|
+
# @since 15.5
|
109
116
|
#
|
110
117
|
# @return [Boolean]
|
111
118
|
#
|
@@ -117,7 +124,8 @@ module ChefUtils
|
|
117
124
|
|
118
125
|
# Determine if the current node is Oracle Linux.
|
119
126
|
#
|
120
|
-
# @param [Chef::Node] node
|
127
|
+
# @param [Chef::Node] node the node to check
|
128
|
+
# @since 15.5
|
121
129
|
#
|
122
130
|
# @return [Boolean]
|
123
131
|
#
|
@@ -131,7 +139,8 @@ module ChefUtils
|
|
131
139
|
|
132
140
|
# Determine if the current node is Scientific Linux.
|
133
141
|
#
|
134
|
-
# @param [Chef::Node] node
|
142
|
+
# @param [Chef::Node] node the node to check
|
143
|
+
# @since 15.5
|
135
144
|
#
|
136
145
|
# @return [Boolean]
|
137
146
|
#
|
@@ -145,7 +154,8 @@ module ChefUtils
|
|
145
154
|
|
146
155
|
# Determine if the current node is ClearOS.
|
147
156
|
#
|
148
|
-
# @param [Chef::Node] node
|
157
|
+
# @param [Chef::Node] node the node to check
|
158
|
+
# @since 15.5
|
149
159
|
#
|
150
160
|
# @return [Boolean]
|
151
161
|
#
|
@@ -157,7 +167,8 @@ module ChefUtils
|
|
157
167
|
|
158
168
|
# Determine if the current node is Fedora.
|
159
169
|
#
|
160
|
-
# @param [Chef::Node] node
|
170
|
+
# @param [Chef::Node] node the node to check
|
171
|
+
# @since 15.5
|
161
172
|
#
|
162
173
|
# @return [Boolean]
|
163
174
|
#
|
@@ -167,7 +178,8 @@ module ChefUtils
|
|
167
178
|
|
168
179
|
# Determine if the current node is Arch Linux
|
169
180
|
#
|
170
|
-
# @param [Chef::Node] node
|
181
|
+
# @param [Chef::Node] node the node to check
|
182
|
+
# @since 15.5
|
171
183
|
#
|
172
184
|
# @return [Boolean]
|
173
185
|
#
|
@@ -177,7 +189,8 @@ module ChefUtils
|
|
177
189
|
|
178
190
|
# Determine if the current node is Solaris2.
|
179
191
|
#
|
180
|
-
# @param [Chef::Node] node
|
192
|
+
# @param [Chef::Node] node the node to check
|
193
|
+
# @since 15.5
|
181
194
|
#
|
182
195
|
# @return [Boolean]
|
183
196
|
#
|
@@ -187,7 +200,8 @@ module ChefUtils
|
|
187
200
|
|
188
201
|
# Determine if the current node is SmartOS.
|
189
202
|
#
|
190
|
-
# @param [Chef::Node] node
|
203
|
+
# @param [Chef::Node] node the node to check
|
204
|
+
# @since 15.5
|
191
205
|
#
|
192
206
|
# @return [Boolean]
|
193
207
|
#
|
@@ -197,7 +211,8 @@ module ChefUtils
|
|
197
211
|
|
198
212
|
# Determine if the current node is OmniOS.
|
199
213
|
#
|
200
|
-
# @param [Chef::Node] node
|
214
|
+
# @param [Chef::Node] node the node to check
|
215
|
+
# @since 15.5
|
201
216
|
#
|
202
217
|
# @return [Boolean]
|
203
218
|
#
|
@@ -209,7 +224,8 @@ module ChefUtils
|
|
209
224
|
|
210
225
|
# Determine if the current node is OpenIndiana.
|
211
226
|
#
|
212
|
-
# @param [Chef::Node] node
|
227
|
+
# @param [Chef::Node] node the node to check
|
228
|
+
# @since 15.5
|
213
229
|
#
|
214
230
|
# @return [Boolean]
|
215
231
|
#
|
@@ -221,7 +237,8 @@ module ChefUtils
|
|
221
237
|
|
222
238
|
# Determine if the current node is Nexenta Core Platform aka Nexenta OS.
|
223
239
|
#
|
224
|
-
# @param [Chef::Node] node
|
240
|
+
# @param [Chef::Node] node the node to check
|
241
|
+
# @since 15.5
|
225
242
|
#
|
226
243
|
# @return [Boolean]
|
227
244
|
#
|
@@ -233,7 +250,8 @@ module ChefUtils
|
|
233
250
|
|
234
251
|
# Determine if the current node is AIX.
|
235
252
|
#
|
236
|
-
# @param [Chef::Node] node
|
253
|
+
# @param [Chef::Node] node the node to check
|
254
|
+
# @since 15.5
|
237
255
|
#
|
238
256
|
# @return [Boolean]
|
239
257
|
#
|
@@ -243,7 +261,8 @@ module ChefUtils
|
|
243
261
|
|
244
262
|
# Determine if the current node is FreeBSD.
|
245
263
|
#
|
246
|
-
# @param [Chef::Node] node
|
264
|
+
# @param [Chef::Node] node the node to check
|
265
|
+
# @since 15.5
|
247
266
|
#
|
248
267
|
# @return [Boolean]
|
249
268
|
#
|
@@ -253,7 +272,8 @@ module ChefUtils
|
|
253
272
|
|
254
273
|
# Determine if the current node is OpenBSD.
|
255
274
|
#
|
256
|
-
# @param [Chef::Node] node
|
275
|
+
# @param [Chef::Node] node the node to check
|
276
|
+
# @since 15.5
|
257
277
|
#
|
258
278
|
# @return [Boolean]
|
259
279
|
#
|
@@ -263,7 +283,8 @@ module ChefUtils
|
|
263
283
|
|
264
284
|
# Determine if the current node is NetBSD.
|
265
285
|
#
|
266
|
-
# @param [Chef::Node] node
|
286
|
+
# @param [Chef::Node] node the node to check
|
287
|
+
# @since 15.5
|
267
288
|
#
|
268
289
|
# @return [Boolean]
|
269
290
|
#
|
@@ -273,7 +294,8 @@ module ChefUtils
|
|
273
294
|
|
274
295
|
# Determine if the current node is DragonFly BSD.
|
275
296
|
#
|
276
|
-
# @param [Chef::Node] node
|
297
|
+
# @param [Chef::Node] node the node to check
|
298
|
+
# @since 15.5
|
277
299
|
#
|
278
300
|
# @return [Boolean]
|
279
301
|
#
|
@@ -283,7 +305,8 @@ module ChefUtils
|
|
283
305
|
|
284
306
|
# Determine if the current node is macOS.
|
285
307
|
#
|
286
|
-
# @param [Chef::Node] node
|
308
|
+
# @param [Chef::Node] node the node to check
|
309
|
+
# @since 15.5
|
287
310
|
#
|
288
311
|
# @return [Boolean]
|
289
312
|
#
|
@@ -295,7 +318,8 @@ module ChefUtils
|
|
295
318
|
|
296
319
|
# Determine if the current node is Gentoo.
|
297
320
|
#
|
298
|
-
# @param [Chef::Node] node
|
321
|
+
# @param [Chef::Node] node the node to check
|
322
|
+
# @since 15.5
|
299
323
|
#
|
300
324
|
# @return [Boolean]
|
301
325
|
#
|
@@ -305,7 +329,8 @@ module ChefUtils
|
|
305
329
|
|
306
330
|
# Determine if the current node is Slackware.
|
307
331
|
#
|
308
|
-
# @param [Chef::Node] node
|
332
|
+
# @param [Chef::Node] node the node to check
|
333
|
+
# @since 15.5
|
309
334
|
#
|
310
335
|
# @return [Boolean]
|
311
336
|
#
|
@@ -315,7 +340,8 @@ module ChefUtils
|
|
315
340
|
|
316
341
|
# Determine if the current node is SuSE.
|
317
342
|
#
|
318
|
-
# @param [Chef::Node] node
|
343
|
+
# @param [Chef::Node] node the node to check
|
344
|
+
# @since 15.5
|
319
345
|
#
|
320
346
|
# @return [Boolean]
|
321
347
|
#
|
@@ -325,7 +351,8 @@ module ChefUtils
|
|
325
351
|
|
326
352
|
# Determine if the current node is OpenSUSE.
|
327
353
|
#
|
328
|
-
# @param [Chef::Node] node
|
354
|
+
# @param [Chef::Node] node the node to check
|
355
|
+
# @since 15.5
|
329
356
|
#
|
330
357
|
# @return [Boolean]
|
331
358
|
#
|
@@ -342,7 +369,8 @@ module ChefUtils
|
|
342
369
|
|
343
370
|
# Determine if the current node is Windows.
|
344
371
|
#
|
345
|
-
# @param [Chef::Node] node
|
372
|
+
# @param [Chef::Node] node the node to check
|
373
|
+
# @since 15.5
|
346
374
|
#
|
347
375
|
# @return [Boolean]
|
348
376
|
#
|
@@ -24,7 +24,8 @@ module ChefUtils
|
|
24
24
|
|
25
25
|
# Determine if the current node is a member of the 'arch' family.
|
26
26
|
#
|
27
|
-
# @param [Chef::Node] node
|
27
|
+
# @param [Chef::Node] node the node to check
|
28
|
+
# @since 15.5
|
28
29
|
#
|
29
30
|
# @return [Boolean]
|
30
31
|
#
|
@@ -36,7 +37,8 @@ module ChefUtils
|
|
36
37
|
|
37
38
|
# Determine if the current node is a member of the 'aix' platform family.
|
38
39
|
#
|
39
|
-
# @param [Chef::Node] node
|
40
|
+
# @param [Chef::Node] node the node to check
|
41
|
+
# @since 15.5
|
40
42
|
#
|
41
43
|
# @return [Boolean]
|
42
44
|
#
|
@@ -46,7 +48,8 @@ module ChefUtils
|
|
46
48
|
|
47
49
|
# Determine if the current node is a member of the 'debian' platform family (Debian, Ubuntu and derivatives).
|
48
50
|
#
|
49
|
-
# @param [Chef::Node] node
|
51
|
+
# @param [Chef::Node] node the node to check
|
52
|
+
# @since 15.5
|
50
53
|
#
|
51
54
|
# @return [Boolean]
|
52
55
|
#
|
@@ -54,9 +57,10 @@ module ChefUtils
|
|
54
57
|
node["platform_family"] == "debian"
|
55
58
|
end
|
56
59
|
|
57
|
-
# Determine if the current node is a member of the 'fedora' platform family (Fedora and
|
60
|
+
# Determine if the current node is a member of the 'fedora' platform family (Fedora and Arista).
|
58
61
|
#
|
59
|
-
# @param [Chef::Node] node
|
62
|
+
# @param [Chef::Node] node the node to check
|
63
|
+
# @since 15.5
|
60
64
|
#
|
61
65
|
# @return [Boolean]
|
62
66
|
#
|
@@ -66,7 +70,8 @@ module ChefUtils
|
|
66
70
|
|
67
71
|
# Determine if the current node is a member of the 'mac_os_x' platform family.
|
68
72
|
#
|
69
|
-
# @param [Chef::Node] node
|
73
|
+
# @param [Chef::Node] node the node to check
|
74
|
+
# @since 15.5
|
70
75
|
#
|
71
76
|
# @return [Boolean]
|
72
77
|
#
|
@@ -82,7 +87,8 @@ module ChefUtils
|
|
82
87
|
|
83
88
|
# Determine if the current node is a member of the 'rhel' platform family (Red Hat, CentOS, Oracle or Scientific Linux, but NOT Amazon Linux or Fedora).
|
84
89
|
#
|
85
|
-
# @param [Chef::Node] node
|
90
|
+
# @param [Chef::Node] node the node to check
|
91
|
+
# @since 15.5
|
86
92
|
#
|
87
93
|
# @return [Boolean]
|
88
94
|
#
|
@@ -94,7 +100,8 @@ module ChefUtils
|
|
94
100
|
|
95
101
|
# Determine if the current node is a rhel6 compatible build (Red Hat, CentOS, Oracle or Scientific Linux).
|
96
102
|
#
|
97
|
-
# @param [Chef::Node] node
|
103
|
+
# @param [Chef::Node] node the node to check
|
104
|
+
# @since 15.5
|
98
105
|
#
|
99
106
|
# @return [Boolean]
|
100
107
|
#
|
@@ -104,7 +111,8 @@ module ChefUtils
|
|
104
111
|
|
105
112
|
# Determine if the current node is a rhel7 compatible build (Red Hat, CentOS, Oracle or Scientific Linux).
|
106
113
|
#
|
107
|
-
# @param [Chef::Node] node
|
114
|
+
# @param [Chef::Node] node the node to check
|
115
|
+
# @since 15.5
|
108
116
|
#
|
109
117
|
# @return [Boolean]
|
110
118
|
#
|
@@ -114,7 +122,8 @@ module ChefUtils
|
|
114
122
|
|
115
123
|
# Determine if the current node is a rhel8 compatible build (Red Hat, CentOS, Oracle or Scientific Linux).
|
116
124
|
#
|
117
|
-
# @param [Chef::Node] node
|
125
|
+
# @param [Chef::Node] node the node to check
|
126
|
+
# @since 15.5
|
118
127
|
#
|
119
128
|
# @return [Boolean]
|
120
129
|
#
|
@@ -124,7 +133,8 @@ module ChefUtils
|
|
124
133
|
|
125
134
|
# Determine if the current node is a member of the 'amazon' platform family.
|
126
135
|
#
|
127
|
-
# @param [Chef::Node] node
|
136
|
+
# @param [Chef::Node] node the node to check
|
137
|
+
# @since 15.5
|
128
138
|
#
|
129
139
|
# @return [Boolean]
|
130
140
|
#
|
@@ -136,7 +146,8 @@ module ChefUtils
|
|
136
146
|
|
137
147
|
# Determine if the current node is a member of the 'solaris2' platform family.
|
138
148
|
#
|
139
|
-
# @param [Chef::Node] node
|
149
|
+
# @param [Chef::Node] node the node to check
|
150
|
+
# @since 15.5
|
140
151
|
#
|
141
152
|
# @return [Boolean]
|
142
153
|
#
|
@@ -148,7 +159,8 @@ module ChefUtils
|
|
148
159
|
|
149
160
|
# Determine if the current node is a member of the 'smartos' platform family.
|
150
161
|
#
|
151
|
-
# @param [Chef::Node] node
|
162
|
+
# @param [Chef::Node] node the node to check
|
163
|
+
# @since 15.5
|
152
164
|
#
|
153
165
|
# @return [Boolean]
|
154
166
|
#
|
@@ -156,9 +168,10 @@ module ChefUtils
|
|
156
168
|
node["platform_family"] == "smartos"
|
157
169
|
end
|
158
170
|
|
159
|
-
# Determine if the current node is a member of the 'suse' platform family
|
171
|
+
# Determine if the current node is a member of the 'suse' platform family (openSUSE, SLES, and SLED).
|
160
172
|
#
|
161
|
-
# @param [Chef::Node] node
|
173
|
+
# @param [Chef::Node] node the node to check
|
174
|
+
# @since 15.5
|
162
175
|
#
|
163
176
|
# @return [Boolean]
|
164
177
|
#
|
@@ -168,7 +181,8 @@ module ChefUtils
|
|
168
181
|
|
169
182
|
# Determine if the current node is a member of the 'gentoo' platform family.
|
170
183
|
#
|
171
|
-
# @param [Chef::Node] node
|
184
|
+
# @param [Chef::Node] node the node to check
|
185
|
+
# @since 15.5
|
172
186
|
#
|
173
187
|
# @return [Boolean]
|
174
188
|
#
|
@@ -178,7 +192,8 @@ module ChefUtils
|
|
178
192
|
|
179
193
|
# Determine if the current node is a member of the 'freebsd' platform family.
|
180
194
|
#
|
181
|
-
# @param [Chef::Node] node
|
195
|
+
# @param [Chef::Node] node the node to check
|
196
|
+
# @since 15.5
|
182
197
|
#
|
183
198
|
# @return [Boolean]
|
184
199
|
#
|
@@ -188,7 +203,8 @@ module ChefUtils
|
|
188
203
|
|
189
204
|
# Determine if the current node is a member of the 'openbsd' platform family.
|
190
205
|
#
|
191
|
-
# @param [Chef::Node] node
|
206
|
+
# @param [Chef::Node] node the node to check
|
207
|
+
# @since 15.5
|
192
208
|
#
|
193
209
|
# @return [Boolean]
|
194
210
|
#
|
@@ -198,7 +214,8 @@ module ChefUtils
|
|
198
214
|
|
199
215
|
# Determine if the current node is a member of the 'netbsd' platform family.
|
200
216
|
#
|
201
|
-
# @param [Chef::Node] node
|
217
|
+
# @param [Chef::Node] node the node to check
|
218
|
+
# @since 15.5
|
202
219
|
#
|
203
220
|
# @return [Boolean]
|
204
221
|
#
|
@@ -208,7 +225,8 @@ module ChefUtils
|
|
208
225
|
|
209
226
|
# Determine if the current node is a member of the 'dragonflybsd' platform family.
|
210
227
|
#
|
211
|
-
# @param [Chef::Node] node
|
228
|
+
# @param [Chef::Node] node the node to check
|
229
|
+
# @since 15.5
|
212
230
|
#
|
213
231
|
# @return [Boolean]
|
214
232
|
#
|
@@ -218,7 +236,8 @@ module ChefUtils
|
|
218
236
|
|
219
237
|
# Determine if the current node is a member of the 'windows' platform family.
|
220
238
|
#
|
221
|
-
# @param [Chef::Node] node
|
239
|
+
# @param [Chef::Node] node the node to check
|
240
|
+
# @since 15.5
|
222
241
|
#
|
223
242
|
# @return [Boolean]
|
224
243
|
#
|
@@ -236,8 +255,10 @@ module ChefUtils
|
|
236
255
|
node ? node["platform_family"] == "windows" : windows_ruby?
|
237
256
|
end
|
238
257
|
|
239
|
-
# Determine if the
|
240
|
-
# this behavior, so this is useful for code which can never be parsed on a non-
|
258
|
+
# Determine if the Ruby VM is currently running on a Windows node (ChefSpec can never stub
|
259
|
+
# this behavior, so this is useful for code which can never be parsed on a non-Windows box).
|
260
|
+
#
|
261
|
+
# @since 15.5
|
241
262
|
#
|
242
263
|
# @return [Boolean]
|
243
264
|
#
|
@@ -257,7 +278,8 @@ module ChefUtils
|
|
257
278
|
# less useful since in no way can AIX trace its lineage back to old redhat distros. This is most useful for
|
258
279
|
# "smells like redhat, including SuSE".
|
259
280
|
#
|
260
|
-
# @param [Chef::Node] node
|
281
|
+
# @param [Chef::Node] node the node to check
|
282
|
+
# @since 15.5
|
261
283
|
#
|
262
284
|
# @return [Boolean]
|
263
285
|
#
|
@@ -265,11 +287,12 @@ module ChefUtils
|
|
265
287
|
fedora_derived?(node) || node["platform_family"] == "suse"
|
266
288
|
end
|
267
289
|
|
268
|
-
# RPM-based distros which are not SuSE and are very loosely similar to fedora, using yum or dnf.
|
269
|
-
# lineage of the distro should have forked off from old redhat fedora distros at some point.
|
270
|
-
# fedora and amazon.
|
290
|
+
# RPM-based distros which are not SuSE and are very loosely similar to fedora, using yum or dnf. The historical
|
291
|
+
# lineage of the distro should have forked off from old redhat fedora distros at some point. Currently rhel,
|
292
|
+
# fedora and amazon. This is most useful for "smells like redhat, but isn't SuSE".
|
271
293
|
#
|
272
|
-
# @param [Chef::Node] node
|
294
|
+
# @param [Chef::Node] node the node to check
|
295
|
+
# @since 15.5
|
273
296
|
#
|
274
297
|
# @return [Boolean]
|
275
298
|
#
|
@@ -277,10 +300,11 @@ module ChefUtils
|
|
277
300
|
redhat_based?(node) || node["platform_family"] == "amazon"
|
278
301
|
end
|
279
302
|
|
280
|
-
# RedHat distros -- fedora and rhel platform_families, nothing else.
|
303
|
+
# RedHat distros -- fedora and rhel platform_families, nothing else. This is most likely not as useful as the
|
281
304
|
# "fedora_dervied?" helper.
|
282
305
|
#
|
283
|
-
# @param [Chef::Node] node
|
306
|
+
# @param [Chef::Node] node the node to check
|
307
|
+
# @since 15.5
|
284
308
|
#
|
285
309
|
# @return [Boolean]
|
286
310
|
#
|
@@ -290,7 +314,8 @@ module ChefUtils
|
|
290
314
|
|
291
315
|
# All of the Solaris-lineage.
|
292
316
|
#
|
293
|
-
# @param [Chef::Node] node
|
317
|
+
# @param [Chef::Node] node the node to check
|
318
|
+
# @since 15.5
|
294
319
|
#
|
295
320
|
# @return [Boolean]
|
296
321
|
#
|
@@ -300,9 +325,10 @@ module ChefUtils
|
|
300
325
|
|
301
326
|
# All of the BSD-lineage.
|
302
327
|
#
|
303
|
-
# Note that
|
328
|
+
# Note that macOS is not included since macOS deviates so significantly from BSD that including it would not be useful.
|
304
329
|
#
|
305
|
-
# @param [Chef::Node] node
|
330
|
+
# @param [Chef::Node] node the node to check
|
331
|
+
# @since 15.5
|
306
332
|
#
|
307
333
|
# @return [Boolean]
|
308
334
|
#
|
@@ -28,6 +28,8 @@ module ChefUtils
|
|
28
28
|
|
29
29
|
# Returns if debian's old rc.d manager is installed (not necessarily the primary init system).
|
30
30
|
#
|
31
|
+
# @since 15.5
|
32
|
+
#
|
31
33
|
# @return [Boolean]
|
32
34
|
#
|
33
35
|
def debianrcd?
|
@@ -36,6 +38,8 @@ module ChefUtils
|
|
36
38
|
|
37
39
|
# Returns if debian's old invoke rc.d manager is installed (not necessarily the primary init system).
|
38
40
|
#
|
41
|
+
# @since 15.5
|
42
|
+
#
|
39
43
|
# @return [Boolean]
|
40
44
|
#
|
41
45
|
def invokercd?
|
@@ -44,6 +48,8 @@ module ChefUtils
|
|
44
48
|
|
45
49
|
# Returns if upstart is installed (not necessarily the primary init system).
|
46
50
|
#
|
51
|
+
# @since 15.5
|
52
|
+
#
|
47
53
|
# @return [Boolean]
|
48
54
|
#
|
49
55
|
def upstart?
|
@@ -52,6 +58,8 @@ module ChefUtils
|
|
52
58
|
|
53
59
|
# Returns if insserv is installed (not necessarily the primary init system).
|
54
60
|
#
|
61
|
+
# @since 15.5
|
62
|
+
#
|
55
63
|
# @return [Boolean]
|
56
64
|
#
|
57
65
|
def insserv?
|
@@ -60,6 +68,8 @@ module ChefUtils
|
|
60
68
|
|
61
69
|
# Returns if redhat's init system is installed (not necessarily the primary init system).
|
62
70
|
#
|
71
|
+
# @since 15.5
|
72
|
+
#
|
63
73
|
# @return [Boolean]
|
64
74
|
#
|
65
75
|
def redhatrcd?
|
@@ -26,7 +26,8 @@ module ChefUtils
|
|
26
26
|
|
27
27
|
# Determine if the current node is Windows Server Core.
|
28
28
|
#
|
29
|
-
# @param [Chef::Node] node
|
29
|
+
# @param [Chef::Node] node the node to check
|
30
|
+
# @since 15.7
|
30
31
|
#
|
31
32
|
# @return [Boolean]
|
32
33
|
#
|
@@ -34,9 +35,10 @@ module ChefUtils
|
|
34
35
|
node["kernel"]["server_core"] == true
|
35
36
|
end
|
36
37
|
|
37
|
-
# Determine if the current node is Windows Workstation
|
38
|
+
# Determine if the current node is Windows Workstation.
|
38
39
|
#
|
39
|
-
# @param [Chef::Node] node
|
40
|
+
# @param [Chef::Node] node the node to check
|
41
|
+
# @since 15.7
|
40
42
|
#
|
41
43
|
# @return [Boolean]
|
42
44
|
#
|
@@ -44,9 +46,10 @@ module ChefUtils
|
|
44
46
|
node["kernel"]["product_type"] == "Workstation"
|
45
47
|
end
|
46
48
|
|
47
|
-
# Determine if the current node is Windows Server
|
49
|
+
# Determine if the current node is Windows Server.
|
48
50
|
#
|
49
|
-
# @param [Chef::Node] node
|
51
|
+
# @param [Chef::Node] node the node to check
|
52
|
+
# @since 15.7
|
50
53
|
#
|
51
54
|
# @return [Boolean]
|
52
55
|
#
|
@@ -56,7 +59,8 @@ module ChefUtils
|
|
56
59
|
|
57
60
|
# Determine the current Windows NT version. The NT version often differs from the marketing version, but offers a good way to find desktop and server releases that are based on the same codebase. IE: NT 6.3 is Windows 8.1 and Windows 2012 R2.
|
58
61
|
#
|
59
|
-
# @param [Chef::Node] node
|
62
|
+
# @param [Chef::Node] node the node to check
|
63
|
+
# @since 15.8
|
60
64
|
#
|
61
65
|
# @return [ChefUtils::VersionString]
|
62
66
|
#
|
@@ -64,9 +68,10 @@ module ChefUtils
|
|
64
68
|
ChefUtils::VersionString.new(node["os_version"])
|
65
69
|
end
|
66
70
|
|
67
|
-
# Determine the installed version of PowerShell
|
71
|
+
# Determine the installed version of PowerShell.
|
68
72
|
#
|
69
|
-
# @param [Chef::Node] node
|
73
|
+
# @param [Chef::Node] node the node to check
|
74
|
+
# @since 15.8
|
70
75
|
#
|
71
76
|
# @return [ChefUtils::VersionString]
|
72
77
|
#
|
data/lib/chef-utils/version.rb
CHANGED
data/spec/unit/dsl/cloud_spec.rb
CHANGED
@@ -79,4 +79,10 @@ RSpec.describe ChefUtils::DSL::Cloud do
|
|
79
79
|
context "on softlayer" do
|
80
80
|
cloud_reports_true_for(:cloud?, :softlayer?, node: { "softlayer" => {}, "cloud" => {} })
|
81
81
|
end
|
82
|
+
|
83
|
+
context "on virtualbox" do
|
84
|
+
it "does not return true for cloud?" do
|
85
|
+
expect(described_class.cloud?({ "virtualbox" => {}, "cloud" => nil })).to be false
|
86
|
+
end
|
87
|
+
end
|
82
88
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 15.
|
4
|
+
version: 15.9.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chef Software, Inc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|