chef-utils 18.0.161 → 18.0.169

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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +201 -201
  3. data/Rakefile +15 -15
  4. data/chef-utils.gemspec +50 -50
  5. data/lib/chef-utils/dist.rb +154 -154
  6. data/lib/chef-utils/dsl/architecture.rb +150 -150
  7. data/lib/chef-utils/dsl/cloud.rb +155 -155
  8. data/lib/chef-utils/dsl/default_paths.rb +60 -60
  9. data/lib/chef-utils/dsl/introspection.rb +134 -134
  10. data/lib/chef-utils/dsl/os.rb +58 -58
  11. data/lib/chef-utils/dsl/path_sanity.rb +39 -39
  12. data/lib/chef-utils/dsl/platform.rb +387 -387
  13. data/lib/chef-utils/dsl/platform_family.rb +360 -360
  14. data/lib/chef-utils/dsl/platform_version.rb +41 -41
  15. data/lib/chef-utils/dsl/service.rb +112 -112
  16. data/lib/chef-utils/dsl/train_helpers.rb +87 -87
  17. data/lib/chef-utils/dsl/virtualization.rb +272 -272
  18. data/lib/chef-utils/dsl/which.rb +123 -123
  19. data/lib/chef-utils/dsl/windows.rb +86 -86
  20. data/lib/chef-utils/internal.rb +114 -114
  21. data/lib/chef-utils/mash.rb +263 -263
  22. data/lib/chef-utils/parallel_map.rb +131 -131
  23. data/lib/chef-utils/version.rb +20 -20
  24. data/lib/chef-utils/version_string.rb +160 -160
  25. data/lib/chef-utils.rb +53 -53
  26. data/spec/spec_helper.rb +100 -100
  27. data/spec/unit/dsl/architecture_spec.rb +151 -151
  28. data/spec/unit/dsl/cloud_spec.rb +93 -93
  29. data/spec/unit/dsl/dsl_spec.rb +34 -34
  30. data/spec/unit/dsl/introspection_spec.rb +201 -201
  31. data/spec/unit/dsl/os_spec.rb +175 -175
  32. data/spec/unit/dsl/path_sanity_spec.rb +86 -86
  33. data/spec/unit/dsl/platform_family_spec.rb +235 -235
  34. data/spec/unit/dsl/platform_spec.rb +252 -252
  35. data/spec/unit/dsl/service_spec.rb +117 -117
  36. data/spec/unit/dsl/virtualization_spec.rb +75 -75
  37. data/spec/unit/dsl/which_spec.rb +171 -171
  38. data/spec/unit/dsl/windows_spec.rb +84 -84
  39. data/spec/unit/mash_spec.rb +51 -51
  40. data/spec/unit/parallel_map_spec.rb +156 -156
  41. metadata +3 -3
@@ -1,155 +1,155 @@
1
- # frozen_string_literal: true
2
- #
3
- # Copyright:: Copyright (c) Chef Software Inc.
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- require_relative "../internal"
20
-
21
- module ChefUtils
22
- module DSL
23
- module Cloud
24
- include Internal
25
-
26
- # Determine if the current node is running in a known cloud.
27
- #
28
- # @param [Chef::Node] node the node to check
29
- # @since 15.8
30
- #
31
- # @return [Boolean]
32
- #
33
- def cloud?(node = __getnode)
34
- # cloud is always present, but nil if not on a cloud
35
- !node["cloud"].nil?
36
- end
37
-
38
- # Determine if the current node is running in Alibaba Cloud
39
- #
40
- # @param [Chef::Node] node the node to check
41
- # @since 17.0
42
- #
43
- # @return [Boolean]
44
- #
45
- def alibaba?(node = __getnode)
46
- node.key?("alibaba")
47
- end
48
-
49
- # Determine if the current node is running in AWS EC2.
50
- #
51
- # @param [Chef::Node] node the node to check
52
- # @since 15.8
53
- #
54
- # @return [Boolean]
55
- #
56
- def ec2?(node = __getnode)
57
- node.key?("ec2")
58
- end
59
-
60
- # Determine if the current node running in Google Compute Engine (GCE).
61
- #
62
- # @param [Chef::Node] node the node to check
63
- # @since 15.8
64
- #
65
- # @return [Boolean]
66
- #
67
- def gce?(node = __getnode)
68
- node.key?("gce")
69
- end
70
-
71
- # Determine if the current node is running in Rackspace.
72
- #
73
- # @param [Chef::Node] node the node to check
74
- # @since 15.8
75
- #
76
- # @return [Boolean]
77
- #
78
- def rackspace?(node = __getnode)
79
- node.key?("rackspace")
80
- end
81
-
82
- # Determine if the current node is running in Eucalyptus.
83
- #
84
- # @param [Chef::Node] node the node to check
85
- # @since 15.8
86
- #
87
- # @return [Boolean]
88
- #
89
- def eucalyptus?(node = __getnode)
90
- node.key?("eucalyptus")
91
- end
92
- # chef-sugar backcompat method
93
- alias_method :euca?, :eucalyptus?
94
-
95
- # Determine if the current node is running in Linode.
96
- #
97
- # @param [Chef::Node] node the node to check
98
- # @since 15.8
99
- #
100
- # @return [Boolean]
101
- #
102
- def linode?(node = __getnode)
103
- node.key?("linode")
104
- end
105
-
106
- # Determine if the current node is running in OpenStack.
107
- #
108
- # @param [Chef::Node] node the node to check
109
- # @since 15.8
110
- #
111
- # @return [Boolean]
112
- #
113
- def openstack?(node = __getnode)
114
- node.key?("openstack")
115
- end
116
-
117
- # Determine if the current node is running in Microsoft Azure.
118
- #
119
- # @param [Chef::Node] node the node to check
120
- # @since 15.8
121
- #
122
- # @return [Boolean]
123
- #
124
- def azure?(node = __getnode)
125
- node.key?("azure")
126
- end
127
-
128
- # Determine if the current node is running in DigitalOcean.
129
- #
130
- # @param [Chef::Node] node the node to check
131
- # @since 15.8
132
- #
133
- # @return [Boolean]
134
- #
135
- def digital_ocean?(node = __getnode)
136
- node.key?("digital_ocean")
137
- end
138
- # chef-sugar backcompat method
139
- alias_method :digitalocean?, :digital_ocean?
140
-
141
- # Determine if the current node is running in SoftLayer (IBM Cloud).
142
- #
143
- # @param [Chef::Node] node the node to check
144
- # @since 15.8
145
- #
146
- # @return [Boolean]
147
- #
148
- def softlayer?(node = __getnode)
149
- node.key?("softlayer")
150
- end
151
-
152
- extend self
153
- end
154
- end
155
- end
1
+ # frozen_string_literal: true
2
+ #
3
+ # Copyright:: Copyright (c) Chef Software Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require_relative "../internal"
20
+
21
+ module ChefUtils
22
+ module DSL
23
+ module Cloud
24
+ include Internal
25
+
26
+ # Determine if the current node is running in a known cloud.
27
+ #
28
+ # @param [Chef::Node] node the node to check
29
+ # @since 15.8
30
+ #
31
+ # @return [Boolean]
32
+ #
33
+ def cloud?(node = __getnode)
34
+ # cloud is always present, but nil if not on a cloud
35
+ !node["cloud"].nil?
36
+ end
37
+
38
+ # Determine if the current node is running in Alibaba Cloud
39
+ #
40
+ # @param [Chef::Node] node the node to check
41
+ # @since 17.0
42
+ #
43
+ # @return [Boolean]
44
+ #
45
+ def alibaba?(node = __getnode)
46
+ node.key?("alibaba")
47
+ end
48
+
49
+ # Determine if the current node is running in AWS EC2.
50
+ #
51
+ # @param [Chef::Node] node the node to check
52
+ # @since 15.8
53
+ #
54
+ # @return [Boolean]
55
+ #
56
+ def ec2?(node = __getnode)
57
+ node.key?("ec2")
58
+ end
59
+
60
+ # Determine if the current node running in Google Compute Engine (GCE).
61
+ #
62
+ # @param [Chef::Node] node the node to check
63
+ # @since 15.8
64
+ #
65
+ # @return [Boolean]
66
+ #
67
+ def gce?(node = __getnode)
68
+ node.key?("gce")
69
+ end
70
+
71
+ # Determine if the current node is running in Rackspace.
72
+ #
73
+ # @param [Chef::Node] node the node to check
74
+ # @since 15.8
75
+ #
76
+ # @return [Boolean]
77
+ #
78
+ def rackspace?(node = __getnode)
79
+ node.key?("rackspace")
80
+ end
81
+
82
+ # Determine if the current node is running in Eucalyptus.
83
+ #
84
+ # @param [Chef::Node] node the node to check
85
+ # @since 15.8
86
+ #
87
+ # @return [Boolean]
88
+ #
89
+ def eucalyptus?(node = __getnode)
90
+ node.key?("eucalyptus")
91
+ end
92
+ # chef-sugar backcompat method
93
+ alias_method :euca?, :eucalyptus?
94
+
95
+ # Determine if the current node is running in Linode.
96
+ #
97
+ # @param [Chef::Node] node the node to check
98
+ # @since 15.8
99
+ #
100
+ # @return [Boolean]
101
+ #
102
+ def linode?(node = __getnode)
103
+ node.key?("linode")
104
+ end
105
+
106
+ # Determine if the current node is running in OpenStack.
107
+ #
108
+ # @param [Chef::Node] node the node to check
109
+ # @since 15.8
110
+ #
111
+ # @return [Boolean]
112
+ #
113
+ def openstack?(node = __getnode)
114
+ node.key?("openstack")
115
+ end
116
+
117
+ # Determine if the current node is running in Microsoft Azure.
118
+ #
119
+ # @param [Chef::Node] node the node to check
120
+ # @since 15.8
121
+ #
122
+ # @return [Boolean]
123
+ #
124
+ def azure?(node = __getnode)
125
+ node.key?("azure")
126
+ end
127
+
128
+ # Determine if the current node is running in DigitalOcean.
129
+ #
130
+ # @param [Chef::Node] node the node to check
131
+ # @since 15.8
132
+ #
133
+ # @return [Boolean]
134
+ #
135
+ def digital_ocean?(node = __getnode)
136
+ node.key?("digital_ocean")
137
+ end
138
+ # chef-sugar backcompat method
139
+ alias_method :digitalocean?, :digital_ocean?
140
+
141
+ # Determine if the current node is running in SoftLayer (IBM Cloud).
142
+ #
143
+ # @param [Chef::Node] node the node to check
144
+ # @since 15.8
145
+ #
146
+ # @return [Boolean]
147
+ #
148
+ def softlayer?(node = __getnode)
149
+ node.key?("softlayer")
150
+ end
151
+
152
+ extend self
153
+ end
154
+ end
155
+ end
@@ -1,60 +1,60 @@
1
- # frozen_string_literal: true
2
- #
3
- # Copyright:: Copyright (c) Chef Software Inc.
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- require_relative "../internal"
20
- require_relative "platform_family"
21
-
22
- module ChefUtils
23
- module DSL
24
- module DefaultPaths
25
- include Internal
26
-
27
- # @since 15.5
28
- def default_paths(env = nil)
29
- env_path = env ? env["PATH"] : __env_path
30
- env_path = "" if env_path.nil?
31
- path_separator = ChefUtils.windows? ? ";" : ":"
32
- # ensure the Ruby and Gem bindirs are included for omnibus chef installs
33
- new_paths = env_path.split(path_separator)
34
- [ __ruby_bindir, __gem_bindir ].compact.each do |path|
35
- new_paths = [ path ] + new_paths unless new_paths.include?(path)
36
- end
37
- __default_paths.each do |path|
38
- new_paths << path unless new_paths.include?(path)
39
- end
40
- new_paths.join(path_separator).encode("utf-8", invalid: :replace, undef: :replace)
41
- end
42
-
43
- private
44
-
45
- def __default_paths
46
- ChefUtils.windows? ? %w{} : %w{/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin}
47
- end
48
-
49
- def __ruby_bindir
50
- RbConfig::CONFIG["bindir"]
51
- end
52
-
53
- def __gem_bindir
54
- Gem.bindir
55
- end
56
-
57
- extend self
58
- end
59
- end
60
- end
1
+ # frozen_string_literal: true
2
+ #
3
+ # Copyright:: Copyright (c) Chef Software Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require_relative "../internal"
20
+ require_relative "platform_family"
21
+
22
+ module ChefUtils
23
+ module DSL
24
+ module DefaultPaths
25
+ include Internal
26
+
27
+ # @since 15.5
28
+ def default_paths(env = nil)
29
+ env_path = env ? env["PATH"] : __env_path
30
+ env_path = "" if env_path.nil?
31
+ path_separator = ChefUtils.windows? ? ";" : ":"
32
+ # ensure the Ruby and Gem bindirs are included for omnibus chef installs
33
+ new_paths = env_path.split(path_separator)
34
+ [ __ruby_bindir, __gem_bindir ].compact.each do |path|
35
+ new_paths = [ path ] + new_paths unless new_paths.include?(path)
36
+ end
37
+ __default_paths.each do |path|
38
+ new_paths << path unless new_paths.include?(path)
39
+ end
40
+ new_paths.join(path_separator).encode("utf-8", invalid: :replace, undef: :replace)
41
+ end
42
+
43
+ private
44
+
45
+ def __default_paths
46
+ ChefUtils.windows? ? %w{} : %w{/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin}
47
+ end
48
+
49
+ def __ruby_bindir
50
+ RbConfig::CONFIG["bindir"]
51
+ end
52
+
53
+ def __gem_bindir
54
+ Gem.bindir
55
+ end
56
+
57
+ extend self
58
+ end
59
+ end
60
+ end