mixlib-install 2.0.4 → 2.1.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 +7 -0
- data/README.md +12 -5
- data/acceptance/powershell_install_ps1/.acceptance/acceptance-cookbook/recipes/provision.rb +1 -1
- data/acceptance/powershell_install_ps1/terraform/application.tf +1 -1
- data/acceptance/ubuntu_install_command/.acceptance/acceptance-cookbook/recipes/provision.rb +1 -1
- data/acceptance/ubuntu_install_command/terraform/application.tf +1 -1
- data/acceptance/ubuntu_install_sh/.acceptance/acceptance-cookbook/recipes/provision.rb +1 -1
- data/acceptance/ubuntu_install_sh/terraform/application.tf +1 -1
- data/ci/script.sh +2 -4
- data/lib/mixlib/install.rb +19 -1
- data/lib/mixlib/install/artifact_info.rb +24 -26
- data/lib/mixlib/install/backend/base.rb +1 -1
- data/lib/mixlib/install/backend/package_router.rb +71 -32
- data/lib/mixlib/install/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71d5046b449ed3757363647374ffc39eeb05f07c
|
4
|
+
data.tar.gz: ae951ab2c716f58ffa374fcfb0602bf610dfaf29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba5b829af49cc93b5d25ae17f617641bdf9a02cf0bb614dbb76dca789af977a5daa0603d994a414dea4639d93a8638e281af7d5d6431db686d64a2b97eef5d2b
|
7
|
+
data.tar.gz: 515fedd4a41787f1dbee8e6e697846f595e2e166d4664a82fcc27d248d0de6189ebaf2436cc2e0150c48d5252fd2f08b23c03bc9614f530ac322c9c4cb276203
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [2.1.0]
|
4
|
+
- Added new attributes to ArtifactInfo
|
5
|
+
- product_name, product_description, license, license_content, software_dependencies
|
6
|
+
- Added static `#available_versions` method to API
|
7
|
+
- Architecture normalization cleanup
|
8
|
+
- Fixed race condition in acceptance suites
|
9
|
+
|
3
10
|
## [2.0.4]
|
4
11
|
- Normalize auto detect platform architectures
|
5
12
|
|
data/README.md
CHANGED
@@ -26,9 +26,9 @@ artifact.url
|
|
26
26
|
```ruby
|
27
27
|
options = {
|
28
28
|
channel: :current,
|
29
|
-
product_name: 'chef'
|
30
|
-
product_version: :latest
|
29
|
+
product_name: 'chef'
|
31
30
|
}
|
31
|
+
# product_version: :latest is the default
|
32
32
|
|
33
33
|
artifacts = Mixlib::Install.new(options).artifact_info
|
34
34
|
# => [#<Mixlib::Install::ArtifactInfo>, ...]
|
@@ -70,16 +70,23 @@ artifact.platform_version # => "14.04"
|
|
70
70
|
```
|
71
71
|
|
72
72
|
### List the available versions for a product and channel
|
73
|
+
#### Instance method
|
73
74
|
```ruby
|
74
|
-
# Note that this feature currently only works for :unstable channel
|
75
75
|
options = {
|
76
|
-
channel: :
|
76
|
+
channel: :stable,
|
77
77
|
product_name: 'chef',
|
78
78
|
}
|
79
79
|
|
80
80
|
Mixlib::Install.new(options).available_versions
|
81
81
|
|
82
|
-
# => ["12.13.3", "12.13.7"
|
82
|
+
# => ["12.13.3", "12.13.7"]
|
83
|
+
```
|
84
|
+
|
85
|
+
#### Static method
|
86
|
+
```ruby
|
87
|
+
Mixlib::Install.available_versions("chef", "stable")
|
88
|
+
|
89
|
+
# => ["12.13.3", "12.13.7"]
|
83
90
|
```
|
84
91
|
|
85
92
|
## Development
|
@@ -1,4 +1,4 @@
|
|
1
|
-
execute "bundle exec ruby -e \"require 'mixlib/install'; puts Mixlib::Install.install_ps1, 'install'\" > ../.acceptance_data/
|
1
|
+
execute "bundle exec ruby -e \"require 'mixlib/install'; puts Mixlib::Install.install_ps1, 'install'\" > ../.acceptance_data/powershell_install.ps1" do
|
2
2
|
cwd node['chef-acceptance']['suite-dir']
|
3
3
|
end
|
4
4
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
execute "bundle exec ruby -e \"require 'mixlib/install'; puts Mixlib::Install.new(product_name: 'omnibus-toolchain', product_version: :latest, channel: :stable).install_command\" > ../.acceptance_data/
|
1
|
+
execute "bundle exec ruby -e \"require 'mixlib/install'; puts Mixlib::Install.new(product_name: 'omnibus-toolchain', product_version: :latest, channel: :stable).install_command\" > ../.acceptance_data/ubuntu_install_command.sh" do
|
2
2
|
cwd node['chef-acceptance']['suite-dir']
|
3
3
|
end
|
4
4
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
execute "bundle exec ruby -e \"require 'mixlib/install'; puts Mixlib::Install.install_sh\" > ../.acceptance_data/
|
1
|
+
execute "bundle exec ruby -e \"require 'mixlib/install'; puts Mixlib::Install.install_sh\" > ../.acceptance_data/ubuntu_install.sh" do
|
2
2
|
cwd node['chef-acceptance']['suite-dir']
|
3
3
|
end
|
4
4
|
|
data/ci/script.sh
CHANGED
@@ -11,8 +11,6 @@ if [ "${TRAVIS_REPO_SLUG}" = "chef/mixlib-install" ]; then
|
|
11
11
|
cd acceptance && export BUNDLE_GEMFILE=$PWD/Gemfile && /opt/chefdk/embedded/bin/bundle install && export APPBUNDLER_ALLOW_RVM=true
|
12
12
|
# run acceptances tests and force cleanup
|
13
13
|
# only testing ubuntu until issues with powershell suite resovled:
|
14
|
-
#
|
15
|
-
|
16
|
-
/opt/chefdk/embedded/bin/bundle exec chef-acceptance test ubuntu_install_command --force-destroy
|
17
|
-
/opt/chefdk/embedded/bin/bundle exec chef-acceptance test ubuntu_install_sh --force-destroy
|
14
|
+
# - currently no way to mask password (sensitive true) AND know what the error is if inspec fails
|
15
|
+
/opt/chefdk/embedded/bin/bundle exec chef-acceptance test ubuntu --force-destroy
|
18
16
|
fi
|
data/lib/mixlib/install.rb
CHANGED
@@ -52,7 +52,25 @@ module Mixlib
|
|
52
52
|
# @return [Array<String>] list of available versions for the given
|
53
53
|
# product_name and channel.
|
54
54
|
def available_versions
|
55
|
-
|
55
|
+
self.class.available_versions(options.product_name, options.channel)
|
56
|
+
end
|
57
|
+
|
58
|
+
#
|
59
|
+
# List available versions
|
60
|
+
#
|
61
|
+
# @param [String] product name
|
62
|
+
#
|
63
|
+
# @param [String, Symbol] channel
|
64
|
+
#
|
65
|
+
# @return [Array<String>] list of available versions for the given
|
66
|
+
# product_name and channel.
|
67
|
+
def self.available_versions(product_name, channel)
|
68
|
+
Backend.available_versions(
|
69
|
+
Mixlib::Install::Options.new(
|
70
|
+
product_name: product_name,
|
71
|
+
channel: channel.to_sym
|
72
|
+
)
|
73
|
+
)
|
56
74
|
end
|
57
75
|
|
58
76
|
#
|
@@ -19,25 +19,31 @@
|
|
19
19
|
module Mixlib
|
20
20
|
class Install
|
21
21
|
class ArtifactInfo
|
22
|
-
attr_reader :url
|
23
|
-
attr_reader :md5
|
24
|
-
attr_reader :sha256
|
25
|
-
attr_reader :sha1
|
26
|
-
attr_reader :version
|
27
22
|
|
28
|
-
|
29
|
-
|
30
|
-
|
23
|
+
ATTRIBUTES = %w{
|
24
|
+
architecture
|
25
|
+
license
|
26
|
+
license_content
|
27
|
+
md5
|
28
|
+
platform
|
29
|
+
platform_version
|
30
|
+
product_description
|
31
|
+
product_name
|
32
|
+
sha1
|
33
|
+
sha256
|
34
|
+
software_dependencies
|
35
|
+
url
|
36
|
+
version
|
37
|
+
}.freeze
|
38
|
+
|
39
|
+
# Dynamically create readers
|
40
|
+
ATTRIBUTES.each { |attribute| attr_reader attribute.to_sym }
|
31
41
|
|
32
42
|
def initialize(data)
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
@version = data[:version]
|
38
|
-
@platform = data[:platform]
|
39
|
-
@platform_version = data[:platform_version]
|
40
|
-
@architecture = data[:architecture]
|
43
|
+
# Create an instance variable for each attribute
|
44
|
+
ATTRIBUTES.each do |attribute|
|
45
|
+
instance_variable_set("@#{attribute}", data[attribute.to_sym])
|
46
|
+
end
|
41
47
|
end
|
42
48
|
|
43
49
|
def self.from_json(json, platform_info)
|
@@ -63,16 +69,8 @@ module Mixlib
|
|
63
69
|
end
|
64
70
|
|
65
71
|
def to_hash
|
66
|
-
|
67
|
-
|
68
|
-
md5: md5,
|
69
|
-
sha256: sha256,
|
70
|
-
sha1: sha1,
|
71
|
-
version: version,
|
72
|
-
platform: platform,
|
73
|
-
platform_version: platform_version,
|
74
|
-
architecture: architecture,
|
75
|
-
}
|
72
|
+
# Create a Hash of the instance data
|
73
|
+
Hash[ATTRIBUTES.map { |attribute| [attribute.to_sym, eval(attribute)] }]
|
76
74
|
end
|
77
75
|
|
78
76
|
def clone_with(data)
|
@@ -158,10 +158,15 @@ Can not find any builds for #{options.product_name} in #{endpoint}.
|
|
158
158
|
end
|
159
159
|
|
160
160
|
def create_artifact(artifact_map)
|
161
|
-
platform
|
162
|
-
|
161
|
+
# set normalized platform and platform version
|
162
|
+
platform, platform_version = normalize_platform(
|
163
|
+
artifact_map["omnibus.platform"],
|
164
|
+
artifact_map["omnibus.platform_version"]
|
165
|
+
)
|
163
166
|
|
164
|
-
|
167
|
+
# create the standardized file path
|
168
|
+
chef_standard_path = generate_chef_standard_path(
|
169
|
+
options.channel,
|
165
170
|
artifact_map["omnibus.project"],
|
166
171
|
artifact_map["omnibus.version"],
|
167
172
|
platform,
|
@@ -169,18 +174,59 @@ Can not find any builds for #{options.product_name} in #{endpoint}.
|
|
169
174
|
artifact_map["filename"]
|
170
175
|
)
|
171
176
|
|
177
|
+
# retrieve the metadata using the standardized path
|
178
|
+
begin
|
179
|
+
metadata = get("#{chef_standard_path}.metadata.json")
|
180
|
+
license_content = metadata["license_content"]
|
181
|
+
software_dependencies = metadata["version_manifest"]["software"]
|
182
|
+
rescue Net::HTTPServerException => e
|
183
|
+
if e.message =~ /404/
|
184
|
+
license_content, software_dependencies = nil
|
185
|
+
else
|
186
|
+
raise e
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
# create the download path with the correct endpoint
|
191
|
+
base_url = if use_compat_download_url_endpoint?(platform, platform_version)
|
192
|
+
COMPAT_DOWNLOAD_URL_ENDPOINT
|
193
|
+
else
|
194
|
+
endpoint
|
195
|
+
end
|
196
|
+
|
172
197
|
ArtifactInfo.new(
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
platform:
|
178
|
-
platform_version:
|
179
|
-
|
180
|
-
|
198
|
+
architecture: normalize_architecture(artifact_map["omnibus.architecture"]),
|
199
|
+
license: artifact_map["omnibus.license"],
|
200
|
+
license_content: license_content,
|
201
|
+
md5: artifact_map["omnibus.md5"],
|
202
|
+
platform: platform,
|
203
|
+
platform_version: platform_version,
|
204
|
+
product_description: product_description,
|
205
|
+
product_name: options.product_name,
|
206
|
+
sha1: artifact_map["omnibus.sha1"],
|
207
|
+
sha256: artifact_map["omnibus.sha256"],
|
208
|
+
software_dependencies: software_dependencies,
|
209
|
+
url: "#{base_url}/#{chef_standard_path}",
|
210
|
+
version: artifact_map["omnibus.version"]
|
181
211
|
)
|
182
212
|
end
|
183
213
|
|
214
|
+
#
|
215
|
+
# For some older platform & platform_version combinations we need to
|
216
|
+
# use COMPAT_DOWNLOAD_URL_ENDPOINT since these versions have an
|
217
|
+
# OpenSSL version that can not verify the ENDPOINT based urls
|
218
|
+
#
|
219
|
+
# @return [boolean] use compat download url endpoint
|
220
|
+
#
|
221
|
+
def use_compat_download_url_endpoint?(platform, platform_version)
|
222
|
+
case "#{platform}-#{platform_version}"
|
223
|
+
when "freebsd-9", "el-5", "solaris2-5.9", "solaris2-5.10"
|
224
|
+
true
|
225
|
+
else
|
226
|
+
false
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
184
230
|
private
|
185
231
|
|
186
232
|
# Converts Array<Hash> where the Hash is a key pair and
|
@@ -194,28 +240,17 @@ Can not find any builds for #{options.product_name} in #{endpoint}.
|
|
194
240
|
end
|
195
241
|
|
196
242
|
# Generates a chef standard download uri in the form of
|
197
|
-
#
|
243
|
+
# /files/:channel/:project/:version/:platform/:platform_version/:file
|
198
244
|
def generate_chef_standard_path(channel, project, version, platform, platform_version, filename)
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
uri = []
|
210
|
-
uri << base_url.sub(/\/$/, "")
|
211
|
-
uri << "files"
|
212
|
-
uri << channel
|
213
|
-
uri << project
|
214
|
-
uri << version
|
215
|
-
uri << platform
|
216
|
-
uri << platform_version
|
217
|
-
uri << filename
|
218
|
-
uri.join("/")
|
245
|
+
path = []
|
246
|
+
path << "files"
|
247
|
+
path << channel
|
248
|
+
path << project
|
249
|
+
path << version
|
250
|
+
path << platform
|
251
|
+
path << platform_version
|
252
|
+
path << filename
|
253
|
+
path.join("/")
|
219
254
|
end
|
220
255
|
|
221
256
|
def endpoint
|
@@ -225,6 +260,10 @@ Can not find any builds for #{options.product_name} in #{endpoint}.
|
|
225
260
|
def omnibus_project
|
226
261
|
@omnibus_project ||= PRODUCT_MATRIX.lookup(options.product_name, options.product_version).omnibus_project
|
227
262
|
end
|
263
|
+
|
264
|
+
def product_description
|
265
|
+
PRODUCT_MATRIX.lookup(options.product_name, options.product_version).product_name
|
266
|
+
end
|
228
267
|
end
|
229
268
|
end
|
230
269
|
end
|