mixlib-install 3.14.0 → 3.15.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: 40469e67a42c0b360b72c220d71d9a2a0c837dc691ed9a74a9923fc81a31240c
4
- data.tar.gz: f816a7403f35f3c51a456783241a485f9e21ff05fea67c5120f0585c9d92e899
3
+ metadata.gz: 87576368d2d140a99f1e02a508c19bb3d55dbc637ca3b4d6b39f6bbfcd857ad6
4
+ data.tar.gz: 4114e92d08cba4ea18093bfaa2e0f02b584dda06de878e56e11fd2c68aa58b9e
5
5
  SHA512:
6
- metadata.gz: 6f9b38fec3b7689879edac7229f5793cd3c4ea842d03cd93d1c4b68afb7f02853008863ef80898a18b0745d5d25fb94afb2f1f6ea6208535bd109b0cdad247bd
7
- data.tar.gz: 0d2470b2ef4d1b130f28f00b06221cfbb8e34034b320c38426953310d5d1d3f91fe2c2be42ba341952582e5f07b73eecd46e6cf999c63a73e287f03904cf1587
6
+ metadata.gz: 428a3a79f93b46f570ac709eaf7fcae54360dc893742360bf42b02ee0565c2992426d1588b4cd4baf6ae7d84898c284148a284824dece7d9890e75964fcea425
7
+ data.tar.gz: 991621b4937be08512cc2bb556a3848485a2a2e0223dc05382987a400131e49d20536d06df04c84a9d3d18acd10d6f93a7e6d34bb83c3022999fcfe59b4d4756
@@ -86,7 +86,8 @@ If no earlier version is found the earliest version available will be set.",
86
86
  }.tap do |opt|
87
87
  opt[:platform] = options[:platform] if options[:platform]
88
88
  opt[:platform_version] = options[:platform_version] if options[:platform_version]
89
- opt[:license_id] = options[:license_id] if options[:license_id]
89
+ # Use license_id from options if provided, otherwise check CHEF_LICENSE_KEY env var
90
+ opt[:license_id] = options[:license_id] || ENV["CHEF_LICENSE_KEY"]
90
91
  end
91
92
 
92
93
  # auto detect platform options if not configured
@@ -1,6 +1,14 @@
1
- # Check for chef-client command in various locations
2
- for path in /hab/pkgs/chef/chef-infra-client/*/*/bin/chef-client "/usr/bin/${project}-client" "/opt/$project/bin/${project}-client"; do
3
- if test -x "$path" 2>/dev/null && test "x$install_strategy" = "xonce"; then
1
+ # Check for product installation in various locations
2
+ if [ "$project" = "chef" ] || [ "$project" = "chef-ice" ]; then
3
+ # For chef or chef-ice, look for chef-infra-client paths
4
+ install_paths="/hab/pkgs/chef/chef-infra-client/*/*/bin /opt/chef/bin"
5
+ else
6
+ # For other products, look for product-specific paths
7
+ install_paths="/hab/pkgs/chef/$project/*/*/bin /opt/$project/bin"
8
+ fi
9
+
10
+ for path in $install_paths; do
11
+ if [ -d "$path" ] 2>/dev/null && [ "x$install_strategy" = "xonce" ]; then
4
12
  echo "$project installation detected at $path"
5
13
  echo "install_strategy set to 'once'"
6
14
  echo "Nothing to install"
@@ -42,3 +42,8 @@ do
42
42
  done
43
43
 
44
44
  shift `expr $OPTIND - 1`
45
+
46
+ # Use CHEF_LICENSE_KEY environment variable if license_id not provided via CLI
47
+ if [ -z "$license_id" ] && [ -n "${CHEF_LICENSE_KEY:-}" ]; then
48
+ license_id="$CHEF_LICENSE_KEY"
49
+ fi
@@ -24,7 +24,19 @@ module Mixlib
24
24
  def self.install_sh(context)
25
25
  install_command = []
26
26
  install_command << get_script("helpers.sh", context)
27
+ # If license_id is provided in context, pre-set it as a variable
28
+ if context[:license_id] && !context[:license_id].to_s.empty?
29
+ install_command << "# License ID provided via context"
30
+ install_command << "license_id='#{context[:license_id]}'"
31
+ end
27
32
  install_command << get_script("script_cli_parameters.sh")
33
+ # Check for CHEF_LICENSE_KEY in execution environment if not already set
34
+ install_command << <<~BASH.chomp
35
+ # Use CHEF_LICENSE_KEY from execution environment if license_id not set
36
+ if [ -z "${license_id:-}" ] && [ -n "${CHEF_LICENSE_KEY:-}" ]; then
37
+ license_id="$CHEF_LICENSE_KEY"
38
+ fi
39
+ BASH
28
40
  install_command << get_script("check_product.sh")
29
41
  install_command << get_script("platform_detection.sh")
30
42
  install_command << get_script("proxy_env.sh")
@@ -62,10 +74,18 @@ project=#{options.product_name}
62
74
  version=#{options.product_version}
63
75
  channel=#{options.channel}
64
76
  EOS
65
- # Add license_id if provided
66
- if options.license_id && !options.license_id.to_s.empty?
67
- vars += "license_id=#{options.license_id}\n"
77
+ # Add license_id if provided, otherwise use CHEF_LICENSE_KEY env var
78
+ license_id_value = options.license_id || ENV["CHEF_LICENSE_KEY"]
79
+ if license_id_value && !license_id_value.to_s.empty?
80
+ vars += "license_id=#{license_id_value}\n"
68
81
  end
82
+ # Check for CHEF_LICENSE_KEY in execution environment if not already set
83
+ vars += <<EOS
84
+ # Use CHEF_LICENSE_KEY from execution environment if license_id not set
85
+ if [ -z "${license_id:-}" ] && [ -n "${CHEF_LICENSE_KEY:-}" ]; then
86
+ license_id="$CHEF_LICENSE_KEY"
87
+ fi
88
+ EOS
69
89
  vars += install_command_vars
70
90
  vars
71
91
  end
@@ -62,14 +62,28 @@ function Install-Project {
62
62
  $license_id
63
63
  )
64
64
 
65
- # Check for chef-client command in various locations
66
- $chef_locations = @(
67
- "$env:systemdrive\hab\pkgs\chef\chef-infra-client\*\*\bin\chef-client.bat",
68
- "$env:systemdrive\<%= windows_dir %>\$project\bin\$project-client.bat"
69
- )
70
- foreach ($path in $chef_locations) {
65
+ # Use CHEF_LICENSE_KEY environment variable if license_id not provided
66
+ if ([string]::IsNullOrEmpty($license_id) -and -not [string]::IsNullOrEmpty($env:CHEF_LICENSE_KEY)) {
67
+ $license_id = $env:CHEF_LICENSE_KEY
68
+ }
69
+
70
+ # Check for product installation in various locations
71
+ if ($project -eq 'chef' -or $project -eq 'chef-ice') {
72
+ # For chef or chef-ice, look for chef-infra-client paths
73
+ $install_locations = @(
74
+ "$env:systemdrive\hab\pkgs\chef\chef-infra-client\*\*\bin",
75
+ "$env:systemdrive\<%= windows_dir %>\chef\bin"
76
+ )
77
+ } else {
78
+ # For other products, look for product-specific paths
79
+ $install_locations = @(
80
+ "$env:systemdrive\hab\pkgs\chef\$project\*\*\bin",
81
+ "$env:systemdrive\<%= windows_dir %>\$project\bin"
82
+ )
83
+ }
84
+ foreach ($path in $install_locations) {
71
85
  $resolved = Get-Item $path -ErrorAction SilentlyContinue | Select-Object -First 1
72
- if ($resolved -and (Test-Path $resolved.FullName) -and ($install_strategy -eq 'once')) {
86
+ if ($resolved -and (Test-Path $resolved.FullName -PathType Container) -and ($install_strategy -eq 'once')) {
73
87
  Write-Host "$project installation detected at $($resolved.FullName)"
74
88
  Write-Host "install_strategy set to 'once'"
75
89
  Write-Host "Nothing to install"
@@ -147,14 +161,14 @@ function Install-Project {
147
161
  if ($pscmdlet.ShouldProcess("$($download_url)", "Download $project")) {
148
162
  Write-Host "Downloading $project from $($download_url) to $download_destination."
149
163
  $download_result = Get-WebContent $download_url -filepath $download_destination
150
-
164
+
151
165
  # For licensed downloads, extract actual filename from Content-Disposition
152
166
  if (-not [string]::IsNullOrEmpty($license_id) -and $download_result -and $download_result.Filename) {
153
167
  $actual_filename = $download_result.Filename
154
168
  Write-Host "Extracted filename from Content-Disposition: $actual_filename"
155
-
169
+
156
170
  $final_destination = join-path $download_directory $actual_filename
157
-
171
+
158
172
  # Move temp file to final location with correct name
159
173
  if ($download_destination -ne $final_destination) {
160
174
  Write-Host "Moving to final location: $final_destination"
@@ -29,6 +29,11 @@ module Mixlib
29
29
 
30
30
  install_command = []
31
31
  install_command << ps1_modularize(install_project_module.join("\n"), "Installer-Module")
32
+ # If license_id is provided in context, add it to the default install command
33
+ if context[:license_id] && !context[:license_id].to_s.empty?
34
+ install_command << "# License ID provided via context - adding to install command"
35
+ install_command << "install -license_id '#{context[:license_id]}'"
36
+ end
32
37
  install_command.join("\n\n")
33
38
  end
34
39
 
@@ -185,6 +185,7 @@ module Mixlib
185
185
  platform_version_compatibility_mode: false,
186
186
  product_version: :latest,
187
187
  include_metadata: false,
188
+ license_id: ENV["CHEF_LICENSE_KEY"],
188
189
  }
189
190
  end
190
191
 
@@ -1,5 +1,5 @@
1
1
  module Mixlib
2
2
  class Install
3
- VERSION = "3.14.0"
3
+ VERSION = "3.15.0"
4
4
  end
5
5
  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.14.0
4
+ version: 3.15.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-01-14 00:00:00.000000000 Z
12
+ date: 2026-01-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mixlib-shellout