chef-utils 18.2.5 → 18.2.7

Sign up to get free protection for your applications and to get access to all the features.
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 +2 -2
@@ -1,154 +1,154 @@
1
- # frozen_string_literal: true
2
- module ChefUtils
3
- # This class is not fully implemented, depending on it is not recommended!
4
- module Dist
5
- class Apply
6
- # The chef-apply product name
7
- PRODUCT = "Chef Infra Apply"
8
-
9
- # The chef-apply binary
10
- EXEC = "chef-apply"
11
- end
12
-
13
- class Automate
14
- # name of the automate product
15
- PRODUCT = "Chef Automate"
16
- end
17
-
18
- class Cli
19
- # the chef-cli product name
20
- PRODUCT = "Chef CLI"
21
-
22
- # the chef-cli gem
23
- GEM = "chef-cli"
24
- end
25
-
26
- class Habitat
27
- # name of the Habitat product
28
- PRODUCT = "Chef Habitat"
29
-
30
- # A short designation for the product
31
- SHORT = "habitat"
32
-
33
- # The hab cli binary
34
- EXEC = "hab"
35
- end
36
-
37
- class Infra
38
- # When referencing a product directly, like Chef (Now Chef Infra)
39
- PRODUCT = "Chef Infra Client"
40
-
41
- # A short designation for the product, used in Windows event logs
42
- # and some nomenclature.
43
- SHORT = "chef"
44
-
45
- # The client's alias (chef-client)
46
- CLIENT = "chef-client"
47
-
48
- # The chef executable, as in `chef gem install` or `chef generate cookbook`
49
- EXEC = "chef"
50
-
51
- # The chef-shell executable
52
- SHELL = "chef-shell"
53
-
54
- # Configuration related constants
55
- # The chef-shell configuration file
56
- SHELL_CONF = "chef_shell.rb"
57
-
58
- # The user's configuration directory
59
- USER_CONF_DIR = ".chef"
60
-
61
- # The suffix for Chef's /etc/chef, /var/chef and C:\\Chef directories
62
- # "chef" => /etc/cinc, /var/cinc, C:\\cinc
63
- DIR_SUFFIX = "chef"
64
-
65
- # The client's gem
66
- GEM = "chef"
67
-
68
- # The client's container image
69
- CONTAINER_REF = "chef/chef"
70
- end
71
-
72
- class Inspec
73
- # The InSpec product name
74
- PRODUCT = "Chef InSpec"
75
-
76
- # The inspec binary
77
- EXEC = "inspec"
78
- end
79
-
80
- class Org
81
- # product Website address
82
- WEBSITE = "https://chef.io"
83
-
84
- # The downloads site
85
- DOWNLOADS_URL = "chef.io/downloads"
86
-
87
- # The legacy conf folder: C:/opscode/chef. Specifically the "opscode" part
88
- # DIR_SUFFIX is appended to it in code where relevant
89
- LEGACY_CONF_DIR = "opscode"
90
-
91
- # Enable forcing Chef EULA
92
- ENFORCE_LICENSE = true
93
-
94
- # product patents page
95
- PATENTS = "https://www.chef.io/patents"
96
-
97
- # knife documentation page
98
- KNIFE_DOCS = "https://docs.chef.io/workstation/knife/"
99
-
100
- # the name of the overall infra product
101
- PRODUCT = "Chef Infra"
102
-
103
- # Omnitruck URL
104
- OMNITRUCK_URL = "https://omnitruck.chef.io/install.sh"
105
- end
106
-
107
- class Server
108
- # The name of the server product
109
- PRODUCT = "Chef Infra Server"
110
-
111
- # The server's configuration directory
112
- CONF_DIR = "/etc/chef-server"
113
-
114
- # The servers's alias (chef-server)
115
- SERVER = "chef-server"
116
-
117
- # The server's configuration utility
118
- SERVER_CTL = "chef-server-ctl"
119
-
120
- # The server`s docs URL
121
- SERVER_DOCS = "https://docs.chef.io/server/"
122
-
123
- # OS user for server
124
- SYSTEM_USER = "opscode"
125
- end
126
-
127
- class Solo
128
- # Chef-Solo's product name
129
- PRODUCT = "Chef Infra Solo"
130
-
131
- # The chef-solo executable (legacy local mode)
132
- EXEC = "chef-solo"
133
- end
134
-
135
- class Workstation
136
- # The full marketing name of the product
137
- PRODUCT = "Chef Workstation"
138
-
139
- # The suffix for Chef Workstation's /opt/chef-workstation or C:\\opscode\chef-workstation
140
- DIR_SUFFIX = "chef-workstation"
141
-
142
- # Workstation banner/help text
143
- DOCS = "https://docs.chef.io/workstation/"
144
- end
145
-
146
- class Zero
147
- # chef-zero executable
148
- PRODUCT = "Chef Infra Zero"
149
-
150
- # The chef-zero executable (local mode)
151
- EXEC = "chef-zero"
152
- end
153
- end
154
- end
1
+ # frozen_string_literal: true
2
+ module ChefUtils
3
+ # This class is not fully implemented, depending on it is not recommended!
4
+ module Dist
5
+ class Apply
6
+ # The chef-apply product name
7
+ PRODUCT = "Chef Infra Apply"
8
+
9
+ # The chef-apply binary
10
+ EXEC = "chef-apply"
11
+ end
12
+
13
+ class Automate
14
+ # name of the automate product
15
+ PRODUCT = "Chef Automate"
16
+ end
17
+
18
+ class Cli
19
+ # the chef-cli product name
20
+ PRODUCT = "Chef CLI"
21
+
22
+ # the chef-cli gem
23
+ GEM = "chef-cli"
24
+ end
25
+
26
+ class Habitat
27
+ # name of the Habitat product
28
+ PRODUCT = "Chef Habitat"
29
+
30
+ # A short designation for the product
31
+ SHORT = "habitat"
32
+
33
+ # The hab cli binary
34
+ EXEC = "hab"
35
+ end
36
+
37
+ class Infra
38
+ # When referencing a product directly, like Chef (Now Chef Infra)
39
+ PRODUCT = "Chef Infra Client"
40
+
41
+ # A short designation for the product, used in Windows event logs
42
+ # and some nomenclature.
43
+ SHORT = "chef"
44
+
45
+ # The client's alias (chef-client)
46
+ CLIENT = "chef-client"
47
+
48
+ # The chef executable, as in `chef gem install` or `chef generate cookbook`
49
+ EXEC = "chef"
50
+
51
+ # The chef-shell executable
52
+ SHELL = "chef-shell"
53
+
54
+ # Configuration related constants
55
+ # The chef-shell configuration file
56
+ SHELL_CONF = "chef_shell.rb"
57
+
58
+ # The user's configuration directory
59
+ USER_CONF_DIR = ".chef"
60
+
61
+ # The suffix for Chef's /etc/chef, /var/chef and C:\\Chef directories
62
+ # "chef" => /etc/cinc, /var/cinc, C:\\cinc
63
+ DIR_SUFFIX = "chef"
64
+
65
+ # The client's gem
66
+ GEM = "chef"
67
+
68
+ # The client's container image
69
+ CONTAINER_REF = "chef/chef"
70
+ end
71
+
72
+ class Inspec
73
+ # The InSpec product name
74
+ PRODUCT = "Chef InSpec"
75
+
76
+ # The inspec binary
77
+ EXEC = "inspec"
78
+ end
79
+
80
+ class Org
81
+ # product Website address
82
+ WEBSITE = "https://chef.io"
83
+
84
+ # The downloads site
85
+ DOWNLOADS_URL = "chef.io/downloads"
86
+
87
+ # The legacy conf folder: C:/opscode/chef. Specifically the "opscode" part
88
+ # DIR_SUFFIX is appended to it in code where relevant
89
+ LEGACY_CONF_DIR = "opscode"
90
+
91
+ # Enable forcing Chef EULA
92
+ ENFORCE_LICENSE = true
93
+
94
+ # product patents page
95
+ PATENTS = "https://www.chef.io/patents"
96
+
97
+ # knife documentation page
98
+ KNIFE_DOCS = "https://docs.chef.io/workstation/knife/"
99
+
100
+ # the name of the overall infra product
101
+ PRODUCT = "Chef Infra"
102
+
103
+ # Omnitruck URL
104
+ OMNITRUCK_URL = "https://omnitruck.chef.io/install.sh"
105
+ end
106
+
107
+ class Server
108
+ # The name of the server product
109
+ PRODUCT = "Chef Infra Server"
110
+
111
+ # The server's configuration directory
112
+ CONF_DIR = "/etc/chef-server"
113
+
114
+ # The servers's alias (chef-server)
115
+ SERVER = "chef-server"
116
+
117
+ # The server's configuration utility
118
+ SERVER_CTL = "chef-server-ctl"
119
+
120
+ # The server`s docs URL
121
+ SERVER_DOCS = "https://docs.chef.io/server/"
122
+
123
+ # OS user for server
124
+ SYSTEM_USER = "opscode"
125
+ end
126
+
127
+ class Solo
128
+ # Chef-Solo's product name
129
+ PRODUCT = "Chef Infra Solo"
130
+
131
+ # The chef-solo executable (legacy local mode)
132
+ EXEC = "chef-solo"
133
+ end
134
+
135
+ class Workstation
136
+ # The full marketing name of the product
137
+ PRODUCT = "Chef Workstation"
138
+
139
+ # The suffix for Chef Workstation's /opt/chef-workstation or C:\\opscode\chef-workstation
140
+ DIR_SUFFIX = "chef-workstation"
141
+
142
+ # Workstation banner/help text
143
+ DOCS = "https://docs.chef.io/workstation/"
144
+ end
145
+
146
+ class Zero
147
+ # chef-zero executable
148
+ PRODUCT = "Chef Infra Zero"
149
+
150
+ # The chef-zero executable (local mode)
151
+ EXEC = "chef-zero"
152
+ end
153
+ end
154
+ end
@@ -1,150 +1,150 @@
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 Architecture
24
- include Internal
25
-
26
- # Determine if the current architecture is 64-bit.
27
- #
28
- # @since 15.5
29
- #
30
- # @return [Boolean]
31
- #
32
- def _64_bit?(node = __getnode)
33
- %w{amd64 x86_64 ppc64 ppc64le s390x ia64 sparc64 aarch64 arch64 arm64 sun4v sun4u}
34
- .include?(node["kernel"]["machine"])
35
- end
36
-
37
- # Determine if the current architecture is 32-bit.
38
- #
39
- # @since 15.5
40
- #
41
- # @return [Boolean]
42
- #
43
- def _32_bit?(node = __getnode)
44
- !_64_bit?(node)
45
- end
46
-
47
- # Determine if the current architecture is i386.
48
- #
49
- # @since 15.5
50
- #
51
- # @return [Boolean]
52
- #
53
- def i386?(node = __getnode)
54
- _32_bit?(node) && intel?(node)
55
- end
56
-
57
- # Determine if the current architecture is Intel.
58
- #
59
- # @since 15.5
60
- #
61
- # @return [Boolean]
62
- #
63
- def intel?(node = __getnode)
64
- %w{i86pc i386 x86_64 amd64 i686}.include?(node["kernel"]["machine"])
65
- end
66
-
67
- # Determine if the current architecture is SPARC.
68
- #
69
- # @since 15.5
70
- #
71
- # @return [Boolean]
72
- #
73
- def sparc?(node = __getnode)
74
- %w{sun4u sun4v}.include?(node["kernel"]["machine"])
75
- end
76
-
77
- # Determine if the current architecture is PowerPC 64bit Big Endian.
78
- #
79
- # @since 15.5
80
- #
81
- # @return [Boolean]
82
- #
83
- def ppc64?(node = __getnode)
84
- %w{ppc64}.include?(node["kernel"]["machine"])
85
- end
86
-
87
- # Determine if the current architecture is PowerPC 64bit Little Endian.
88
- #
89
- # @since 15.5
90
- #
91
- # @return [Boolean]
92
- #
93
- def ppc64le?(node = __getnode)
94
- %w{ppc64le}.include?(node["kernel"]["machine"])
95
- end
96
-
97
- # Determine if the current architecture is PowerPC.
98
- #
99
- # @since 15.5
100
- #
101
- # @return [Boolean]
102
- #
103
- def powerpc?(node = __getnode)
104
- %w{powerpc}.include?(node["kernel"]["machine"])
105
- end
106
-
107
- # Determine if the current architecture is arm
108
- #
109
- # @since 15.10
110
- #
111
- # @return [Boolean]
112
- #
113
- def arm?(node = __getnode)
114
- %w{armv6l armv7l armhf aarch64 arm64 arch64}.include?(node["kernel"]["machine"])
115
- end
116
-
117
- # Determine if the current architecture is 32-bit ARM hard float.
118
- #
119
- # @since 15.5
120
- #
121
- # @return [Boolean]
122
- #
123
- def armhf?(node = __getnode)
124
- %w{armv6l armv7l armhf}.include?(node["kernel"]["machine"])
125
- end
126
-
127
- # Determine if the current architecture is s390x.
128
- #
129
- # @since 15.5
130
- #
131
- # @return [Boolean]
132
- #
133
- def s390x?(node = __getnode)
134
- %w{s390x}.include?(node["kernel"]["machine"])
135
- end
136
-
137
- # Determine if the current architecture is s390.
138
- #
139
- # @since 15.5
140
- #
141
- # @return [Boolean]
142
- #
143
- def s390?(node = __getnode)
144
- %w{s390}.include?(node["kernel"]["machine"])
145
- end
146
-
147
- extend self
148
- end
149
- end
150
- 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 Architecture
24
+ include Internal
25
+
26
+ # Determine if the current architecture is 64-bit.
27
+ #
28
+ # @since 15.5
29
+ #
30
+ # @return [Boolean]
31
+ #
32
+ def _64_bit?(node = __getnode)
33
+ %w{amd64 x86_64 ppc64 ppc64le s390x ia64 sparc64 aarch64 arch64 arm64 sun4v sun4u}
34
+ .include?(node["kernel"]["machine"])
35
+ end
36
+
37
+ # Determine if the current architecture is 32-bit.
38
+ #
39
+ # @since 15.5
40
+ #
41
+ # @return [Boolean]
42
+ #
43
+ def _32_bit?(node = __getnode)
44
+ !_64_bit?(node)
45
+ end
46
+
47
+ # Determine if the current architecture is i386.
48
+ #
49
+ # @since 15.5
50
+ #
51
+ # @return [Boolean]
52
+ #
53
+ def i386?(node = __getnode)
54
+ _32_bit?(node) && intel?(node)
55
+ end
56
+
57
+ # Determine if the current architecture is Intel.
58
+ #
59
+ # @since 15.5
60
+ #
61
+ # @return [Boolean]
62
+ #
63
+ def intel?(node = __getnode)
64
+ %w{i86pc i386 x86_64 amd64 i686}.include?(node["kernel"]["machine"])
65
+ end
66
+
67
+ # Determine if the current architecture is SPARC.
68
+ #
69
+ # @since 15.5
70
+ #
71
+ # @return [Boolean]
72
+ #
73
+ def sparc?(node = __getnode)
74
+ %w{sun4u sun4v}.include?(node["kernel"]["machine"])
75
+ end
76
+
77
+ # Determine if the current architecture is PowerPC 64bit Big Endian.
78
+ #
79
+ # @since 15.5
80
+ #
81
+ # @return [Boolean]
82
+ #
83
+ def ppc64?(node = __getnode)
84
+ %w{ppc64}.include?(node["kernel"]["machine"])
85
+ end
86
+
87
+ # Determine if the current architecture is PowerPC 64bit Little Endian.
88
+ #
89
+ # @since 15.5
90
+ #
91
+ # @return [Boolean]
92
+ #
93
+ def ppc64le?(node = __getnode)
94
+ %w{ppc64le}.include?(node["kernel"]["machine"])
95
+ end
96
+
97
+ # Determine if the current architecture is PowerPC.
98
+ #
99
+ # @since 15.5
100
+ #
101
+ # @return [Boolean]
102
+ #
103
+ def powerpc?(node = __getnode)
104
+ %w{powerpc}.include?(node["kernel"]["machine"])
105
+ end
106
+
107
+ # Determine if the current architecture is arm
108
+ #
109
+ # @since 15.10
110
+ #
111
+ # @return [Boolean]
112
+ #
113
+ def arm?(node = __getnode)
114
+ %w{armv6l armv7l armhf aarch64 arm64 arch64}.include?(node["kernel"]["machine"])
115
+ end
116
+
117
+ # Determine if the current architecture is 32-bit ARM hard float.
118
+ #
119
+ # @since 15.5
120
+ #
121
+ # @return [Boolean]
122
+ #
123
+ def armhf?(node = __getnode)
124
+ %w{armv6l armv7l armhf}.include?(node["kernel"]["machine"])
125
+ end
126
+
127
+ # Determine if the current architecture is s390x.
128
+ #
129
+ # @since 15.5
130
+ #
131
+ # @return [Boolean]
132
+ #
133
+ def s390x?(node = __getnode)
134
+ %w{s390x}.include?(node["kernel"]["machine"])
135
+ end
136
+
137
+ # Determine if the current architecture is s390.
138
+ #
139
+ # @since 15.5
140
+ #
141
+ # @return [Boolean]
142
+ #
143
+ def s390?(node = __getnode)
144
+ %w{s390}.include?(node["kernel"]["machine"])
145
+ end
146
+
147
+ extend self
148
+ end
149
+ end
150
+ end