mixlib-install 3.16.0 → 3.17.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d34030b7986d54d5391add8b932400aad83b2623f9a03a60667d54f82de8c50
4
- data.tar.gz: e86a1612a3de84529fc03193e02d8e290609e389dd33bbeeef4d55fa929662fd
3
+ metadata.gz: a8834bc88f13ec12a50e22d4173262a60a525c4c1841d7fbf078a078f05aaa75
4
+ data.tar.gz: 606b0c99f0b2245e5e5b7ccc50c15b306dd3a7e20406225342733075c9bf1069
5
5
  SHA512:
6
- metadata.gz: d978a599bd28442d1c2324d15e6e7898b312a30453c3e6cc778145f1afa2b3ff219ab632cc486b240c7052863777dfdb9d7d3049c699ade7a92319efc50eebcf
7
- data.tar.gz: b68a1acc6f92a826a74ab867c2e6db32e31d96442d34c3154330d2a8c554a2e1d780f2d0148d7b18fdea185542711e490c16eca7aa9c3ac1df45eb701cba78b8
6
+ metadata.gz: fbc683eca04103659882fdf18678b7e7221b590285794896ecfb5d73fee6d5313407eb959565ee2ae320fef92e911f47b5fe810e63d7af77d44c1f05d1da1bdc
7
+ data.tar.gz: b4fa005ff07749845435b43d5df9fcf4a256924415e416beaa145c91f5cf0251d01945d90749cd34c375d5591bac18643ca65668686b242d8e3661ac68de801a
@@ -84,23 +84,9 @@ module Mixlib
84
84
  def filter_artifacts(artifacts)
85
85
  return artifacts unless platform_filters_available?
86
86
 
87
- # For chef-ice, normalize the platform for comparison since chef-ice uses
88
- # normalized platform names (linux, macos, windows) in the API response
89
- comparison_platform = if options.product_name == "chef-ice"
90
- Util.normalize_platform_for_commercial(options.platform)
91
- else
92
- options.platform
93
- end
94
-
95
- # First filter the artifacts based on the platform and architecture
87
+ # Filter by the exact platform and architecture the user requested.
96
88
  artifacts.select! do |a|
97
- a.platform == comparison_platform && a.architecture == options.architecture
98
- end
99
-
100
- # For chef-ice, platform_version is not used (it's empty in responses)
101
- # so we should return the first match if available
102
- if options.product_name == "chef-ice"
103
- return artifacts.first if artifacts.any?
89
+ a.platform == options.platform && a.architecture == options.architecture
104
90
  end
105
91
 
106
92
  # Now we are going to filter based on platform_version.
@@ -33,12 +33,19 @@ module Mixlib
33
33
 
34
34
  COMPAT_DOWNLOAD_URL_ENDPOINT = "http://packages.chef.io".freeze
35
35
 
36
+ # Architecture strings that appear as level-2 keys in PM-structure packages
37
+ # responses (platform -> arch -> pm -> ...) vs version strings in standard
38
+ # responses (platform -> version -> arch -> ...).
39
+ KNOWN_ARCHITECTURES = %w{x86_64 aarch64 i386 arm64 ppc64 ppc64le s390x universal x86}.freeze
40
+
36
41
  # Create filtered list of artifacts
37
42
  #
38
43
  # @return [Array<ArtifactInfo>] list of artifacts for the configured
39
44
  # channel, product name, and product version.
40
45
  def available_artifacts
41
- artifacts = if options.latest_version? || options.partial_version?
46
+ artifacts = if use_licensed_api? && platform_filters_available?
47
+ artifact_from_licensed_metadata
48
+ elsif options.latest_version? || options.partial_version?
42
49
  latest_version
43
50
  else
44
51
  artifacts_for_version(options.product_version)
@@ -78,10 +85,12 @@ module Mixlib
78
85
 
79
86
  # Circumvent early when there are no product artifacts in a specific channel
80
87
  if items.empty?
88
+ hint = options.license_id ? "" : "For habitat based products please provide a license ID with -L or set CHEF_LICENSE_KEY."
81
89
  raise ArtifactsNotFound, <<-EOF
82
90
  No artifacts found matching criteria.
83
91
  product name: #{options.product_name}
84
92
  channel: #{options.channel}
93
+ #{hint}
85
94
  EOF
86
95
  end
87
96
 
@@ -106,6 +115,9 @@ EOF
106
115
  #
107
116
  # @return [Array<ArtifactInfo>] Array of info about found artifacts
108
117
  def latest_version
118
+ # Trial API only supports "latest" as the version — skip version resolution
119
+ return artifacts_for_version("latest") if use_trial_api?
120
+
109
121
  product_versions = if options.partial_version?
110
122
  v = options.product_version
111
123
  partial_version = v.end_with?(".") ? v : v + "."
@@ -138,27 +150,24 @@ EOF
138
150
  query = "v=#{version}"
139
151
  packages_hash = get("/#{options.channel}/#{omnibus_project}/packages?#{query}")
140
152
  # Response structure differs between products:
141
- # - For chef-ice: platform -> architecture -> package_manager -> package_info
142
- # - For other products: platform -> platform_version -> architecture -> package_info
153
+ # - PM-structure products (e.g. chef-ice, inspec-enterprise): platform -> architecture -> package_manager -> package_info
154
+ # - Standard products: platform -> platform_version -> architecture -> package_info
143
155
  results = []
144
- if omnibus_project == "chef-ice"
145
- # chef-ice structure: platform -> architecture -> package_manager -> package_info
156
+ if pm_structure_response?(packages_hash)
146
157
  packages_hash.each do |platform, architectures|
147
158
  architectures.each do |arch, package_managers|
148
- package_managers.each do |pm, pkg_info|
149
- results << {
150
- "omnibus.version" => pkg_info["version"],
151
- "omnibus.platform" => platform,
152
- "omnibus.platform_version" => "",
153
- "omnibus.architecture" => arch,
154
- "omnibus.project" => omnibus_project,
155
- "omnibus.license" => "Apache-2.0",
156
- "omnibus.sha256" => pkg_info["sha256"],
157
- "omnibus.sha1" => pkg_info.fetch("sha1", ""),
158
- "omnibus.md5" => pkg_info.fetch("md5", ""),
159
- "omnibus.package_manager" => pm,
160
- }
161
- end
159
+ pkg_info = package_managers.values.first
160
+ results << {
161
+ "omnibus.version" => pkg_info["version"],
162
+ "omnibus.platform" => platform,
163
+ "omnibus.platform_version" => "",
164
+ "omnibus.architecture" => arch,
165
+ "omnibus.project" => omnibus_project,
166
+ "omnibus.license" => "Apache-2.0",
167
+ "omnibus.sha256" => pkg_info["sha256"],
168
+ "omnibus.sha1" => pkg_info.fetch("sha1", ""),
169
+ "omnibus.md5" => pkg_info.fetch("md5", ""),
170
+ }
162
171
  end
163
172
  end
164
173
  else
@@ -242,6 +251,50 @@ EOF
242
251
  request
243
252
  end
244
253
 
254
+ # Detects whether a packages API response uses PM-structure format.
255
+ # Standard: platform -> platform_version -> architecture -> pkg_info
256
+ #
257
+ # Detection: PM-structure has architecture strings (x86_64, aarch64, …) as
258
+ # the second-level keys; standard has version strings (20.04, 18.04, …).
259
+ def pm_structure_response?(packages_hash)
260
+ first_platform = packages_hash.values.first
261
+ return false unless first_platform.is_a?(Hash)
262
+
263
+ first_platform.keys.any? { |k| KNOWN_ARCHITECTURES.include?(k) }
264
+ end
265
+
266
+ # Fetches a single artifact from the licensed API metadata endpoint.
267
+ # Used when a platform is specified, giving the server full context to
268
+ # derive the package manager and return the correct sha256 — no pm needed.
269
+ def artifact_from_licensed_metadata
270
+ version = (options.latest_version? || options.partial_version?) ? "latest" : options.product_version
271
+ query = "v=#{version}&p=#{options.platform}&m=#{Util.normalize_architecture(options.architecture)}"
272
+ query += "&pv=#{options.platform_version}" unless options.platform_version.to_s.empty?
273
+
274
+ begin
275
+ metadata = get("/#{options.channel}/#{omnibus_project}/metadata?#{query}")
276
+ rescue Net::HTTPServerException => e
277
+ return [] if e.message.match?(/400|404/)
278
+
279
+ raise e
280
+ end
281
+
282
+ return [] if metadata.nil? || metadata.empty?
283
+
284
+ artifact_map = {
285
+ "omnibus.version" => metadata["version"],
286
+ "omnibus.platform" => options.platform,
287
+ "omnibus.platform_version" => options.platform_version.to_s,
288
+ "omnibus.architecture" => options.architecture,
289
+ "omnibus.project" => omnibus_project,
290
+ "omnibus.license" => "Apache-2.0",
291
+ "omnibus.sha256" => metadata["sha256"],
292
+ "omnibus.sha1" => metadata.fetch("sha1", ""),
293
+ "omnibus.md5" => metadata.fetch("md5", ""),
294
+ }
295
+ [create_artifact(artifact_map)]
296
+ end
297
+
245
298
  def create_artifact(artifact_map)
246
299
  # set normalized platform and platform version
247
300
  platform, platform_version = normalize_platform(
@@ -279,22 +332,15 @@ EOF
279
332
 
280
333
  # create the download path with the correct endpoint
281
334
  if use_licensed_api?
282
- # Commercial/trial APIs use the download endpoint with query parameters
283
- # Construct platform parameters
284
- p_param = platform
285
- pv_param = platform_version
335
+ # Commercial/trial APIs use the download endpoint with query parameters.
336
+
286
337
  m_param = Util.normalize_architecture(artifact_map["omnibus.architecture"])
287
338
  v_param = artifact_map["omnibus.version"]
288
-
289
- # For chef-ice, use normalized platform names and add package manager parameter
290
- if omnibus_project == "chef-ice"
291
- p_param = Util.normalize_platform_for_commercial(platform)
292
- # Use package_manager from artifact_map if available, otherwise determine it
293
- pm_param = artifact_map.fetch("omnibus.package_manager", Util.determine_package_manager(options.platform))
294
- download_url = "#{endpoint}/#{options.channel}/#{omnibus_project}/download?v=#{v_param}&license_id=#{options.license_id}&m=#{m_param}&p=#{p_param}&pm=#{pm_param}"
295
- else
296
- download_url = "#{endpoint}/#{options.channel}/#{omnibus_project}/download?p=#{p_param}&pv=#{pv_param}&m=#{m_param}&v=#{v_param}&license_id=#{options.license_id}"
297
- end
339
+ # Use the user's actual platform (e.g. "ubuntu", "el") so the server can derive pm.
340
+ p_param = options.platform || platform
341
+ pv_param = options.platform_version || platform_version
342
+ pv_part = pv_param.to_s.empty? ? "" : "&pv=#{pv_param}"
343
+ download_url = "#{endpoint}/#{options.channel}/#{omnibus_project}/download?p=#{p_param}#{pv_part}&m=#{m_param}&v=#{v_param}&license_id=#{options.license_id}"
298
344
  else
299
345
  base_url = if use_compat_download_url_endpoint?(platform, platform_version)
300
346
  COMPAT_DOWNLOAD_URL_ENDPOINT
@@ -31,8 +31,12 @@ module Mixlib
31
31
  end
32
32
 
33
33
  desc "list-versions PRODUCT_NAME CHANNEL", "list available version for a product/channel"
34
+ option :license_id,
35
+ desc: "License ID for commercial/trial API",
36
+ aliases: ["-L"]
34
37
  def list_versions(product_name, channel)
35
- say Mixlib::Install.available_versions(product_name, channel).join("\n")
38
+ lid = options[:license_id] || ENV["CHEF_LICENSE_KEY"]
39
+ say Mixlib::Install.available_versions(product_name, channel, license_id: lid).join("\n")
36
40
  end
37
41
 
38
42
  desc "list-products", "list available products"
@@ -25,46 +25,6 @@
25
25
  # $sha256:
26
26
  ############
27
27
 
28
- # Determine package manager based on platform for commercial API
29
- determine_package_manager() {
30
- case "$platform" in
31
- el|centos|rhel|fedora|amazon|rocky|opensuse*|sles|scientific)
32
- echo "rpm"
33
- ;;
34
- debian|ubuntu|linuxmint|raspbian)
35
- echo "deb"
36
- ;;
37
- mac_os_x|macos|solaris*|smartos|freebsd|aix|omnios)
38
- echo "tar"
39
- ;;
40
- *)
41
- echo "tar"
42
- ;;
43
- esac
44
- }
45
-
46
- # Normalize platform name for commercial API
47
- normalize_platform_name() {
48
- case "$platform" in
49
- el|centos|rhel|fedora|rocky|scientific)
50
- echo "linux"
51
- ;;
52
- mac_os_x|macos)
53
- echo "macos"
54
- ;;
55
- debian|ubuntu|linuxmint|raspbian)
56
- echo "linux"
57
- ;;
58
- freebsd|aix|solaris*|smartos|omnios)
59
- echo "unix"
60
- ;;
61
- *)
62
- # For anything else, use linux as default
63
- echo "linux"
64
- ;;
65
- esac
66
- }
67
-
68
28
  if [ -z "$download_url_override" ]; then
69
29
  echo "Getting information for $project $channel $version for $platform..."
70
30
 
@@ -96,21 +56,21 @@ if [ -z "$download_url_override" ]; then
96
56
  fi
97
57
  fi
98
58
 
99
- # For chef-ice product, add platform (p), machine (m), and package_manager (pm) parameters
100
59
  if [ -n "$license_id" ]; then
101
- if [ "$project" = "chef-ice" ]; then
102
- package_manager=$(determine_package_manager)
103
- platform_param=$(normalize_platform_name)
104
- metadata_url="$base_api_url/$channel/$project/metadata?license_id=$license_id&v=$version&m=$machine&p=$platform_param&pm=$package_manager"
105
- else
106
- # For other products, use standard parameters
107
- metadata_url="$base_api_url/$channel/$project/metadata?license_id=$license_id&v=$version&p=$platform&pv=$platform_version&m=$machine"
108
- fi
60
+ license_param="&license_id=$license_id"
109
61
  else
110
- # Omnitruck URL parameters without license_id
111
- metadata_url="$base_api_url/$channel/$project/metadata?v=$version&p=$platform&pv=$platform_version&m=$machine"
62
+ license_param=""
112
63
  fi
113
64
 
65
+ if [ -n "$package_manager" ]; then
66
+ pm_param="&pm=$package_manager"
67
+ else
68
+ pm_param=""
69
+ fi
70
+
71
+ # Build the metadata URL.
72
+ metadata_url="$base_api_url/$channel/$project/metadata?v=$version&p=$platform&pv=$platform_version&m=$machine${license_param}${pm_param}"
73
+
114
74
  do_download "$metadata_url" "$metadata_filename"
115
75
 
116
76
  cat "$metadata_filename"
@@ -148,15 +148,15 @@ do_curl() {
148
148
  echo "trying curl..."
149
149
  # If filename is empty, use -O and -J to get filename from Content-Disposition header
150
150
  if [ -z "$2" ]; then
151
- curl -A "User-Agent: <%= user_agent_string %>" --retry 5 -sL -D $tmp_dir/stderr -O -J "$1"
151
+ curl -A "User-Agent: <%= user_agent_string %>" --retry 5 -sL --fail -D $tmp_dir/stderr -O -J "$1"
152
152
  rc=$?
153
153
  else
154
- curl -A "User-Agent: <%= user_agent_string %>" --retry 5 -sL -D $tmp_dir/stderr "$1" > "$2"
154
+ curl -A "User-Agent: <%= user_agent_string %>" --retry 5 -sL --fail -D $tmp_dir/stderr "$1" > "$2"
155
155
  rc=$?
156
156
  fi
157
157
 
158
- # check for 404
159
- if grep "404 Not Found" $tmp_dir/stderr 2>&1 >/dev/null; then
158
+ # check for 404 (matches both HTTP/1.1 "404 Not Found" and HTTP/2 "404")
159
+ if grep "404" $tmp_dir/stderr 2>&1 >/dev/null; then
160
160
  echo "ERROR 404"
161
161
  http_404_error
162
162
  fi
@@ -190,10 +190,14 @@ do_perl() {
190
190
  echo "trying perl..."
191
191
  perl -e 'use LWP::Simple; getprint($ARGV[0]);' "$1" > "$2" 2>$tmp_dir/stderr
192
192
  rc=$?
193
- # check for 404
194
- if grep "404 Not Found" $tmp_dir/stderr 2>&1 >/dev/null; then
195
- echo "ERROR 404"
196
- http_404_error
193
+ # check for HTTP error status codes (4xx/5xx)
194
+ if grep "^[45][0-9][0-9] " $tmp_dir/stderr 2>&1 >/dev/null; then
195
+ if grep "404 Not Found" $tmp_dir/stderr 2>&1 >/dev/null; then
196
+ echo "ERROR 404"
197
+ http_404_error
198
+ fi
199
+ capture_tmp_stderr "perl"
200
+ return 1
197
201
  fi
198
202
 
199
203
  # check for bad return status or empty output
@@ -7,6 +7,8 @@
7
7
  # $version: Requested version to be installed.
8
8
  # $channel: Channel to install the product from
9
9
  # $project: Project to be installed
10
+ # $package_manager: (Optional) Package manager override (e.g. rpm, deb, tar, msi).
11
+ # If omitted, the server derives it from the platform (p) parameter.
10
12
  # $cmdline_filename: Name of the package downloaded on local disk.
11
13
  # $cmdline_dl_dir: Name of the directory downloaded package will be saved to on local disk.
12
14
  # $install_strategy: Method of package installations. default strategy is to always install upon exec. Set to "once" to skip if project is installed
@@ -18,9 +20,10 @@
18
20
  # Defaults
19
21
  channel="stable"
20
22
  project="<%= default_product %>"
23
+ package_manager=""
21
24
  <%= "license_id=\"#{license_id}\"" if license_id && !license_id.to_s.empty? %>
22
25
 
23
- while getopts pnv:b:c:f:P:d:s:l:a:L: opt
26
+ while getopts pnv:b:c:f:P:d:s:l:a:L:i: opt
24
27
  do
25
28
  case "$opt" in
26
29
 
@@ -36,9 +39,10 @@ do
36
39
  l) download_url_override="$OPTARG";;
37
40
  a) checksum="$OPTARG";;
38
41
  L) license_id="$OPTARG";;
42
+ i) package_manager="$OPTARG";;
39
43
  \?) # unknown flag
40
44
  echo >&2 \
41
- "usage: $0 [-P project] [-b base_api_url] [-c release_channel] [-v version] [-f filename | -d download_dir] [-s install_strategy] [-l download_url_override] [-a checksum] [-L license_id]"
45
+ "usage: $0 [-P project] [-b base_api_url] [-c release_channel] [-v version] [-f filename | -d download_dir] [-s install_strategy] [-l download_url_override] [-a checksum] [-L license_id] [-i package_manager]"
42
46
  exit 1;;
43
47
  esac
44
48
  done
@@ -42,7 +42,10 @@ function Get-ProjectMetadata {
42
42
  $architecture = 'auto',
43
43
  # License ID for commercial API access
44
44
  [string]
45
- $license_id <%= "= '#{license_id}'" if license_id && !license_id.to_s.empty? %>
45
+ $license_id <%= "= '#{license_id}'" if license_id && !license_id.to_s.empty? %>,
46
+ # Package manager override (e.g. msi, zip). If omitted, the server derives it from platform.
47
+ [string]
48
+ $package_manager
46
49
  )
47
50
 
48
51
  # The following legacy switches are just aliases for the current channel
@@ -88,23 +91,28 @@ function Get-ProjectMetadata {
88
91
  }
89
92
  }
90
93
 
91
- # For chef-ice product, add platform (p), machine (m), and package_manager (pm) parameters
94
+ # Only include pm param when the caller explicitly passed -package_manager;
95
+ # the server derives it from the platform (p) parameter otherwise.
96
+
97
+ if (-not [string]::IsNullOrEmpty($package_manager)) {
98
+ $pm_param = "&pm=$package_manager"
99
+ }
100
+ else {
101
+ $pm_param = ""
102
+ }
103
+
104
+ # License param (appended only when a license_id is present)
105
+ $license_param = ""
92
106
  if (-not [string]::IsNullOrEmpty($license_id)) {
93
- if ($project -eq "chef-ice") {
94
- $package_manager = "msi"
95
- $platform_param = "windows"
96
- $metadata_url = "$base_server_uri$channel/$project/metadata?license_id=$license_id&v=$version&m=$architecture&p=$platform_param&pm=$package_manager"
97
- }
98
- else {
99
- # For other products, use standard parameters
100
- $metadata_url = "$base_server_uri$channel/$project/metadata?license_id=$license_id&v=$version&p=$platform&pv=$platform_version&m=$architecture"
101
- }
107
+ $license_param = "&license_id=$license_id"
102
108
  }
103
109
  else {
104
- # Omnitruck URL parameters without license_id
105
- $metadata_url = "$base_server_uri$channel/$project/metadata?v=$version&p=$platform&pv=$platform_version&m=$architecture"
110
+ $license_param = ""
106
111
  }
107
112
 
113
+ # Build the metadata URL.
114
+ $metadata_url = "$base_server_uri$channel/$project/metadata?v=$version&p=$platform&pv=$platform_version&m=$architecture$license_param$pm_param"
115
+
108
116
  Write-Host "Downloading $project details from $metadata_url"
109
117
  $response = (Get-WebContent $metadata_url).trim()
110
118
 
@@ -62,7 +62,10 @@ function Install-Project {
62
62
  $base_server_uri,
63
63
  # License ID for commercial API access
64
64
  [string]
65
- $license_id <%= "= '#{license_id}'" if license_id && !license_id.to_s.empty? %>
65
+ $license_id <%= "= '#{license_id}'" if license_id && !license_id.to_s.empty? %>,
66
+ # Package manager override (e.g. msi, zip). If omitted, the server derives it from platform.
67
+ [string]
68
+ $package_manager
66
69
  )
67
70
 
68
71
  # Use CHEF_LICENSE_KEY environment variable if license_id not provided
@@ -106,7 +109,7 @@ function Install-Project {
106
109
  $download_url = $download_url_override
107
110
  $sha256 = $checksum
108
111
  } else {
109
- $package_metadata = Get-ProjectMetadata -project $project -channel $channel -version $version -prerelease:$prerelease -nightlies:$nightlies -architecture $architecture -base_server_uri $base_server_uri -license_id $license_id
112
+ $package_metadata = Get-ProjectMetadata -project $project -channel $channel -version $version -prerelease:$prerelease -nightlies:$nightlies -architecture $architecture -base_server_uri $base_server_uri -license_id $license_id -package_manager $package_manager
110
113
  $download_url = $package_metadata.url
111
114
  $sha256 = $package_metadata.sha256
112
115
  }
@@ -155,6 +155,11 @@ PRODUCT_MATRIX = Mixlib::Install::ProductMatrix.new do
155
155
  package_name "inspec"
156
156
  end
157
157
 
158
+ product "inspec-enterprise" do
159
+ product_name "Chef InSpec Enterprise"
160
+ package_name "inspec-enterprise"
161
+ end
162
+
158
163
  product "mac-bootstrapper" do
159
164
  product_name "Habitat Mac Bootstrapper"
160
165
  package_name "mac-bootstrapper"
@@ -278,14 +278,7 @@ module Mixlib
278
278
  url = "#{base}#{endpoint}"
279
279
  end
280
280
 
281
- # chef-ice uses different parameters than chef
282
- if @project.casecmp("chef-ice") == 0
283
- # For chef-ice: p (platform), m (machine), pm (package_manager)
284
- url << "?p=windows&m=$platform_architecture&pm=msi"
285
- else
286
- # For chef and other products: p (platform), pv (platform_version), m (machine)
287
- url << "?p=windows&m=$platform_architecture&pv=$platform_version"
288
- end
281
+ url << "?p=windows&m=$platform_architecture&pv=$platform_version"
289
282
  url << "&v=#{CGI.escape(version)}" unless %w{latest true nightlies}.include?(version)
290
283
  url << "&prerelease=true" if prerelease
291
284
  url << "&nightlies=true" if nightlies
@@ -172,53 +172,6 @@ module Mixlib
172
172
  architecture
173
173
  end
174
174
  end
175
-
176
- #
177
- # Determines package manager based on platform for commercial API
178
- #
179
- # @param [String] platform
180
- #
181
- # @return String [package_manager] (rpm, deb, tar, msi, dmg)
182
- def determine_package_manager(platform)
183
- case platform
184
- when /^el/, /^centos/, /^rhel/, /^fedora/, /^amazon/, /^rocky/, /^opensuse/, /^sles/, /^scientific/
185
- "rpm"
186
- when /^debian/, /^ubuntu/, /^linuxmint/, /^raspbian/
187
- "deb"
188
- when /^mac_os_x/, /^macos/
189
- "dmg"
190
- when /^windows/
191
- "msi"
192
- when /^solaris/, /^smartos/, /^freebsd/, /^aix/, /^omnios/
193
- "tar"
194
- else
195
- # Default to tar for unknown platforms
196
- "tar"
197
- end
198
- end
199
-
200
- #
201
- # Normalizes platform name for commercial API (chef-ice)
202
- # Maps specific platform names to generic categories
203
- #
204
- # @param [String] platform
205
- #
206
- # @return String [normalized_platform] (linux, macos, windows)
207
- def normalize_platform_for_commercial(platform)
208
- case platform
209
- when /^el/, /^centos/, /^rhel/, /^fedora/, /^rocky/, /^scientific/, /^debian/, /^ubuntu/, /^linuxmint/, /^raspbian/, /^opensuse/, /^sles/, /^amazon/
210
- "linux"
211
- when /^mac_os_x/, /^macos/
212
- "macos"
213
- when /^windows/
214
- "windows"
215
- when /^freebsd/, /^aix/, /^solaris/, /^smartos/, /^omnios/
216
- "unix"
217
- else
218
- # Default to linux for unknown platforms
219
- "linux"
220
- end
221
- end
222
175
  end
223
176
  end
224
177
  end
@@ -1,5 +1,5 @@
1
1
  module Mixlib
2
2
  class Install
3
- VERSION = "3.16.0"
3
+ VERSION = "3.17.0"
4
4
  end
5
5
  end
@@ -63,14 +63,18 @@ module Mixlib
63
63
  #
64
64
  # @param [String, Symbol] channel
65
65
  #
66
+ # @param [String] license_id (optional)
67
+ #
66
68
  # @return [Array<String>] list of available versions for the given
67
69
  # product_name and channel.
68
- def self.available_versions(product_name, channel)
70
+ def self.available_versions(product_name, channel, license_id: nil)
71
+ opts = {
72
+ product_name: product_name,
73
+ channel: channel.to_sym,
74
+ }
75
+ opts[:license_id] = license_id if license_id
69
76
  Backend.available_versions(
70
- Mixlib::Install::Options.new(
71
- product_name: product_name,
72
- channel: channel.to_sym
73
- )
77
+ Mixlib::Install::Options.new(opts)
74
78
  )
75
79
  end
76
80
 
@@ -19,5 +19,7 @@ Gem::Specification.new do |spec|
19
19
 
20
20
  spec.add_dependency "mixlib-shellout"
21
21
  spec.add_dependency "mixlib-versioning"
22
+ spec.add_dependency "ostruct"
22
23
  spec.add_dependency "thor"
24
+ spec.required_ruby_version = ">= 2.6"
23
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mixlib-install
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.16.0
4
+ version: 3.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thom May
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2026-02-24 00:00:00.000000000 Z
12
+ date: 2026-05-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mixlib-shellout
@@ -39,6 +39,20 @@ dependencies:
39
39
  - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: ostruct
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
42
56
  - !ruby/object:Gem::Dependency
43
57
  name: thor
44
58
  requirement: !ruby/object:Gem::Requirement
@@ -110,7 +124,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
110
124
  requirements:
111
125
  - - ">="
112
126
  - !ruby/object:Gem::Version
113
- version: '0'
127
+ version: '2.6'
114
128
  required_rubygems_version: !ruby/object:Gem::Requirement
115
129
  requirements:
116
130
  - - ">="