From 51e102858734f6ff6ebcddcfb98cb89feb8b6b8e Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Tue, 12 May 2026 18:22:04 -0500 Subject: [PATCH 1/3] CHEF-32484: remove os normalization and make pm optional Signed-off-by: Corey Hemminger --- PRODUCT_MATRIX.md | 1 + .../bourne/scripts/fetch_metadata.sh.erb | 62 ++---- .../scripts/script_cli_parameters.sh.erb | 8 +- .../scripts/get_project_metadata.ps1.erb | 34 ++-- .../scripts/install_project.ps1.erb | 7 +- lib/mixlib/install/product_matrix.rb | 5 + mixlib-install.gemspec | 1 + spec/unit/mixlib/install/generator_spec.rb | 181 +++++++++++++----- 8 files changed, 183 insertions(+), 116 deletions(-) diff --git a/PRODUCT_MATRIX.md b/PRODUCT_MATRIX.md index aab04a2f..d64f9175 100644 --- a/PRODUCT_MATRIX.md +++ b/PRODUCT_MATRIX.md @@ -18,6 +18,7 @@ | Chef Infra Server High Availability addon | ha | | Harmony - Omnibus Integration Internal Test Project | harmony | | Chef InSpec | inspec | +| Chef InSpec Enterprise | inspec-enterprise | | Habitat Mac Bootstrapper | mac-bootstrapper | | Management Console | manage | | Chef Cloud Marketplace addon | marketplace | diff --git a/lib/mixlib/install/generator/bourne/scripts/fetch_metadata.sh.erb b/lib/mixlib/install/generator/bourne/scripts/fetch_metadata.sh.erb index e6cf9a3b..9fac0b29 100644 --- a/lib/mixlib/install/generator/bourne/scripts/fetch_metadata.sh.erb +++ b/lib/mixlib/install/generator/bourne/scripts/fetch_metadata.sh.erb @@ -25,46 +25,6 @@ # $sha256: ############ -# Determine package manager based on platform for commercial API -determine_package_manager() { - case "$platform" in - el|centos|rhel|fedora|amazon|rocky|opensuse*|sles|scientific) - echo "rpm" - ;; - debian|ubuntu|linuxmint|raspbian) - echo "deb" - ;; - mac_os_x|macos|solaris*|smartos|freebsd|aix|omnios) - echo "tar" - ;; - *) - echo "tar" - ;; - esac -} - -# Normalize platform name for commercial API -normalize_platform_name() { - case "$platform" in - el|centos|rhel|fedora|rocky|scientific) - echo "linux" - ;; - mac_os_x|macos) - echo "macos" - ;; - debian|ubuntu|linuxmint|raspbian) - echo "linux" - ;; - freebsd|aix|solaris*|smartos|omnios) - echo "unix" - ;; - *) - # For anything else, use linux as default - echo "linux" - ;; - esac -} - if [ -z "$download_url_override" ]; then echo "Getting information for $project $channel $version for $platform..." @@ -96,21 +56,21 @@ if [ -z "$download_url_override" ]; then fi fi - # For chef-ice product, add platform (p), machine (m), and package_manager (pm) parameters if [ -n "$license_id" ]; then - if [ "$project" = "chef-ice" ]; then - package_manager=$(determine_package_manager) - platform_param=$(normalize_platform_name) - metadata_url="$base_api_url/$channel/$project/metadata?license_id=$license_id&v=$version&m=$machine&p=$platform_param&pm=$package_manager" - else - # For other products, use standard parameters - metadata_url="$base_api_url/$channel/$project/metadata?license_id=$license_id&v=$version&p=$platform&pv=$platform_version&m=$machine" - fi + license_param="&license_id=$license_id" else - # Omnitruck URL parameters without license_id - metadata_url="$base_api_url/$channel/$project/metadata?v=$version&p=$platform&pv=$platform_version&m=$machine" + license_param="" fi + if [ -n "$package_manager" ]; then + pm_param="&pm=$package_manager" + else + pm_param="" + fi + + # Build the metadata URL. + metadata_url="$base_api_url/$channel/$project/metadata?v=$version&p=$platform&pv=$platform_version&m=$machine${license_param}${pm_param}" + do_download "$metadata_url" "$metadata_filename" cat "$metadata_filename" diff --git a/lib/mixlib/install/generator/bourne/scripts/script_cli_parameters.sh.erb b/lib/mixlib/install/generator/bourne/scripts/script_cli_parameters.sh.erb index 5316782a..4baafb89 100644 --- a/lib/mixlib/install/generator/bourne/scripts/script_cli_parameters.sh.erb +++ b/lib/mixlib/install/generator/bourne/scripts/script_cli_parameters.sh.erb @@ -7,6 +7,8 @@ # $version: Requested version to be installed. # $channel: Channel to install the product from # $project: Project to be installed +# $package_manager: (Optional) Package manager override (e.g. rpm, deb, tar, msi). +# If omitted, the server derives it from the platform (p) parameter. # $cmdline_filename: Name of the package downloaded on local disk. # $cmdline_dl_dir: Name of the directory downloaded package will be saved to on local disk. # $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 @@ # Defaults channel="stable" project="<%= default_product %>" +package_manager="" <%= "license_id=\"#{license_id}\"" if license_id && !license_id.to_s.empty? %> -while getopts pnv:b:c:f:P:d:s:l:a:L: opt +while getopts pnv:b:c:f:P:d:s:l:a:L:i: opt do case "$opt" in @@ -36,9 +39,10 @@ do l) download_url_override="$OPTARG";; a) checksum="$OPTARG";; L) license_id="$OPTARG";; + i) package_manager="$OPTARG";; \?) # unknown flag echo >&2 \ - "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]" + "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]" exit 1;; esac done diff --git a/lib/mixlib/install/generator/powershell/scripts/get_project_metadata.ps1.erb b/lib/mixlib/install/generator/powershell/scripts/get_project_metadata.ps1.erb index 5e840a81..fd17f702 100644 --- a/lib/mixlib/install/generator/powershell/scripts/get_project_metadata.ps1.erb +++ b/lib/mixlib/install/generator/powershell/scripts/get_project_metadata.ps1.erb @@ -42,7 +42,10 @@ function Get-ProjectMetadata { $architecture = 'auto', # License ID for commercial API access [string] - $license_id <%= "= '#{license_id}'" if license_id && !license_id.to_s.empty? %> + $license_id <%= "= '#{license_id}'" if license_id && !license_id.to_s.empty? %>, + # Package manager override (e.g. msi, zip). If omitted, the server derives it from platform. + [string] + $package_manager ) # The following legacy switches are just aliases for the current channel @@ -88,23 +91,28 @@ function Get-ProjectMetadata { } } - # For chef-ice product, add platform (p), machine (m), and package_manager (pm) parameters + # Only include pm param when the caller explicitly passed -package_manager; + # the server derives it from the platform (p) parameter otherwise. + + if (-not [string]::IsNullOrEmpty($package_manager)) { + $pm_param = "&pm=$package_manager" + } + else { + $pm_param = "" + } + + # License param (appended only when a license_id is present) + $license_param = "" if (-not [string]::IsNullOrEmpty($license_id)) { - if ($project -eq "chef-ice") { - $package_manager = "msi" - $platform_param = "windows" - $metadata_url = "$base_server_uri$channel/$project/metadata?license_id=$license_id&v=$version&m=$architecture&p=$platform_param&pm=$package_manager" - } - else { - # For other products, use standard parameters - $metadata_url = "$base_server_uri$channel/$project/metadata?license_id=$license_id&v=$version&p=$platform&pv=$platform_version&m=$architecture" - } + $license_param = "&license_id=$license_id" } else { - # Omnitruck URL parameters without license_id - $metadata_url = "$base_server_uri$channel/$project/metadata?v=$version&p=$platform&pv=$platform_version&m=$architecture" + $license_param = "" } + # Build the metadata URL. + $metadata_url = "$base_server_uri$channel/$project/metadata?v=$version&p=$platform&pv=$platform_version&m=$architecture$license_param$pm_param" + Write-Host "Downloading $project details from $metadata_url" $response = (Get-WebContent $metadata_url).trim() diff --git a/lib/mixlib/install/generator/powershell/scripts/install_project.ps1.erb b/lib/mixlib/install/generator/powershell/scripts/install_project.ps1.erb index df3b5aa9..739bcee7 100644 --- a/lib/mixlib/install/generator/powershell/scripts/install_project.ps1.erb +++ b/lib/mixlib/install/generator/powershell/scripts/install_project.ps1.erb @@ -62,7 +62,10 @@ function Install-Project { $base_server_uri, # License ID for commercial API access [string] - $license_id <%= "= '#{license_id}'" if license_id && !license_id.to_s.empty? %> + $license_id <%= "= '#{license_id}'" if license_id && !license_id.to_s.empty? %>, + # Package manager override (e.g. msi, zip). If omitted, the server derives it from platform. + [string] + $package_manager ) # Use CHEF_LICENSE_KEY environment variable if license_id not provided @@ -106,7 +109,7 @@ function Install-Project { $download_url = $download_url_override $sha256 = $checksum } else { - $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_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 $download_url = $package_metadata.url $sha256 = $package_metadata.sha256 } diff --git a/lib/mixlib/install/product_matrix.rb b/lib/mixlib/install/product_matrix.rb index 0c61e6a5..73fd16c8 100644 --- a/lib/mixlib/install/product_matrix.rb +++ b/lib/mixlib/install/product_matrix.rb @@ -155,6 +155,11 @@ package_name "inspec" end + product "inspec-enterprise" do + product_name "Chef InSpec Enterprise" + package_name "inspec-enterprise" + end + product "mac-bootstrapper" do product_name "Habitat Mac Bootstrapper" package_name "mac-bootstrapper" diff --git a/mixlib-install.gemspec b/mixlib-install.gemspec index 2866b382..999637c7 100644 --- a/mixlib-install.gemspec +++ b/mixlib-install.gemspec @@ -19,6 +19,7 @@ Gem::Specification.new do |spec| spec.add_dependency "mixlib-shellout" spec.add_dependency "mixlib-versioning" + spec.add_dependency "ostruct" spec.add_dependency "thor" spec.required_ruby_version = ">= 2.6" end diff --git a/spec/unit/mixlib/install/generator_spec.rb b/spec/unit/mixlib/install/generator_spec.rb index aa436a05..568a87f9 100644 --- a/spec/unit/mixlib/install/generator_spec.rb +++ b/spec/unit/mixlib/install/generator_spec.rb @@ -309,45 +309,27 @@ } end - it "includes package manager detection function" do - expect(install_script).to include("determine_package_manager()") + it "does not include client-side package manager detection function" do + expect(install_script).not_to include("determine_package_manager()") end - it "includes platform normalization function" do - expect(install_script).to include("normalize_platform_name()") + it "does not include client-side platform normalization function" do + expect(install_script).not_to include("normalize_platform_name()") end - it "includes chef-ice conditional logic" do - expect(install_script).to include('if [ "$project" = "chef-ice" ]; then') + it "sends platform as-is (no client-side normalization)" do + # Platform variable used directly, no rewriting + expect(install_script).to include("p=$platform") + expect(install_script).not_to include("platform_param=") end - it "includes RPM-based platform detection" do - expect(install_script).to include("el|centos|rhel|fedora|amazon|rocky") - expect(install_script).to include('echo "rpm"') + it "uses unified URL including pv for all products" do + expect(install_script).to include("pv=$platform_version") end - it "includes DEB-based platform detection" do - expect(install_script).to include("debian|ubuntu|linuxmint|raspbian") - expect(install_script).to include('echo "deb"') - end - - it "includes TAR-based platform detection" do - expect(install_script).to include("mac_os_x|macos|solaris*|smartos|freebsd|aix") - expect(install_script).to include('echo "tar"') - end - - it "includes platform normalization for Linux" do - expect(install_script).to include("el|centos|rhel|fedora|rocky") - expect(install_script).to include('echo "linux"') - end - - it "includes platform normalization for macOS" do - expect(install_script).to include("mac_os_x|macos") - expect(install_script).to include('echo "macos"') - end - - it "constructs chef-ice metadata URL with m, p, pm parameters" do - expect(install_script).to include('metadata_url="$base_api_url/$channel/$project/metadata?license_id=$license_id&v=$version&m=$machine&p=$platform_param&pm=$package_manager"') + it "builds pm_param only when user specifies -i flag" do + expect(install_script).to include('if [ -n "$package_manager" ]; then') + expect(install_script).to include('pm_param="&pm=$package_manager"') end it "uses commercial API endpoint" do @@ -362,12 +344,13 @@ } end - it "includes chef-ice conditional logic" do - expect(install_script).to include('if [ "$project" = "chef-ice" ]; then') + it "sends platform as-is in URL" do + expect(install_script).to include("p=$platform") + expect(install_script).not_to include("platform_param=") end - it "constructs chef-ice metadata URL with m, p, pm parameters" do - expect(install_script).to include('metadata_url="$base_api_url/$channel/$project/metadata?license_id=$license_id&v=$version&m=$machine&p=$platform_param&pm=$package_manager"') + it "uses unified URL including pv for all products" do + expect(install_script).to include("pv=$platform_version") end it "uses trial API endpoint" do @@ -377,7 +360,54 @@ it "works with trial- prefix" do add_options[:license_id] = "trial-abc-456" expect(install_script).to include("https://chefdownload-trial.chef.io") - expect(install_script).to include('if [ "$project" = "chef-ice" ]; then') + end + end + + context "inspec-enterprise server-side pm derivation" do + let(:add_options) do + { + license_id: "test-license-key-123", + } + end + + it "uses a single unified URL for all products (no product-specific conditionals)" do + # The server derives pm from platform; no product-specific if-blocks in the script + expect(install_script).not_to include('[ "$project" = "inspec-enterprise" ]') + expect(install_script).to include("pv=$platform_version") + expect(install_script).to include("p=$platform") + end + + it "appends pm_param only when package_manager is explicitly set" do + expect(install_script).to include('if [ -n "$package_manager" ]; then') + expect(install_script).to include('pm_param="&pm=$package_manager"') + end + end + + context "optional package_manager -i flag (bash)" do + # script_cli_parameters.sh.erb is only rendered by the class method install_sh, + # not by the instance install_command (which uses render_variables instead). + let(:install_script) { Mixlib::Install.install_sh({}) } + + it "accepts -i flag in getopts" do + expect(install_script).to include("getopts pnv:b:c:f:P:d:s:l:a:L:i:") + end + + it "sets package_manager from -i flag" do + expect(install_script).to include("i) package_manager=\"$OPTARG\";;") + end + + it "initialises package_manager to empty string" do + expect(install_script).to include('package_manager=""') + end + + it "only adds pm param when package_manager is non-empty" do + expect(install_script).to include('pm_param=""') + expect(install_script).to include('if [ -n "$package_manager" ]; then') + expect(install_script).to include('pm_param="&pm=$package_manager"') + end + + it "includes -i in the usage message" do + expect(install_script).to include("[-i package_manager]") end end @@ -574,17 +604,21 @@ it_behaves_like "the correct ps1 script" - it "includes chef-ice conditional logic" do - expect(install_script).to include('if ($project -eq "chef-ice")') + it "does not hardcode package_manager or platform_param" do + expect(install_script).not_to include('$package_manager = "msi"') + expect(install_script).not_to include('$platform_param = "windows"') end - it "includes simplified parameters for chef-ice on Windows" do - expect(install_script).to include('$platform_param = "windows"') - expect(install_script).to include('$package_manager = "msi"') + it "sends platform as-is (p=$platform) with pv for all products" do + expect(install_script).to include("p=$platform") + expect(install_script).not_to include("p=$platform_param") + expect(install_script).to include("pv=$platform_version") end - it "constructs chef-ice metadata URL with m, p, pm parameters" do - expect(install_script).to include('$metadata_url = "$base_server_uri$channel/$project/metadata?license_id=$license_id&v=$version&m=$architecture&p=$platform_param&pm=$package_manager"') + it "builds pm_param only when package_manager is supplied" do + expect(install_script).to include('$pm_param = ""') + expect(install_script).to include('-not [string]::IsNullOrEmpty($package_manager)') + expect(install_script).to include('$pm_param = "&pm=$package_manager"') end it "uses commercial API endpoint" do @@ -603,13 +637,14 @@ it_behaves_like "the correct ps1 script" - it "includes chef-ice conditional logic" do - expect(install_script).to include('if ($project -eq "chef-ice")') + it "does not hardcode package_manager or platform_param" do + expect(install_script).not_to include('$package_manager = "msi"') + expect(install_script).not_to include('$platform_param = "windows"') end - it "includes simplified parameters for chef-ice on Windows" do - expect(install_script).to include('$platform_param = "windows"') - expect(install_script).to include('$package_manager = "msi"') + it "uses unified URL including pv for all products" do + expect(install_script).to include("pv=$platform_version") + expect(install_script).to include("p=$platform") end it "uses trial API endpoint" do @@ -621,6 +656,56 @@ expect(install_script).to include("https://chefdownload-trial.chef.io") end end + + context "inspec-enterprise server-side pm derivation for PowerShell" do + let(:add_options) do + { + product_name: "inspec-enterprise", + shell_type: :ps1, + license_id: "test-license-key-123", + } + end + + it_behaves_like "the correct ps1 script" + + it "uses a single unified URL for all products (no product-specific conditionals)" do + # The server derives pm from platform; no product-specific if-blocks in the script + expect(install_script).not_to include('$project -eq "inspec-enterprise"') + expect(install_script).to include("pv=$platform_version") + expect(install_script).to include("p=$platform") + end + + it "appends pm_param only when package_manager is explicitly set" do + expect(install_script).to include('-not [string]::IsNullOrEmpty($package_manager)') + expect(install_script).to include('$pm_param = "&pm=$package_manager"') + end + end + + context "optional package_manager parameter for PowerShell" do + let(:add_options) do + { + shell_type: :ps1, + license_id: "test-license-key-123", + } + end + + it "includes $package_manager as an optional parameter in Get-ProjectMetadata" do + expect(install_script).to include("$package_manager") + end + + it "includes $package_manager as an optional parameter in Install-Project" do + expect(install_script).to include("$package_manager") + end + + it "initialises pm_param to empty string" do + expect(install_script).to include('$pm_param = ""') + end + + it "only adds pm param when package_manager is non-empty" do + expect(install_script).to include('-not [string]::IsNullOrEmpty($package_manager)') + expect(install_script).to include('$pm_param = "&pm=$package_manager"') + end + end end end From cd945eea4d73777b9e0ad0e0a85e02c8a419dbdb Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Tue, 12 May 2026 18:31:25 -0500 Subject: [PATCH 2/3] linting fixes and copilot-instructions update Signed-off-by: Corey Hemminger --- .github/copilot-instructions.md | 29 ++++++++++++---------- spec/unit/mixlib/install/generator_spec.rb | 6 ++--- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 5cbf336f..82957cfa 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -6,11 +6,12 @@ Mixlib::Install is a library for interacting with Chef Software Inc's software d **Primary Goal**: Support the widest range of Ruby versions possible to ensure compatibility across diverse Chef environments. **Recent Major Changes** (v3.13.0 - v3.15.0): -- **PR #417**: Added chef-ice product with package_manager parameter support - - Implemented platform normalization (`Util.normalize_platform_for_commercial`) for chef-ice - - Added package manager detection (`Util.determine_package_manager`) for automatic format selection - - Updated URL construction to use `m`, `p`, `pm` parameters for chef-ice (vs. `p`, `pv`, `m` for standard products) - - Modified shell and PowerShell scripts to handle chef-ice metadata URLs +- **PR #417**: Added chef-ice and inspec-enterprise product support with server-side pm derivation + - Server (omnitruck-service) derives package manager (`pm`) from platform automatically; no client-side detection + - Client sends platform as-is (`p=$platform`); no client-side normalization + - Single unified metadata URL for all products: `v`, `p`, `pv`, `m`, optional `pm`, optional `license_id` + - `-i ` shell flag and `$package_manager` PowerShell parameter allow explicit pm override when needed + - Added `inspec-enterprise` product to product matrix - **PR #408, #416**: Added commercial and trial API support for licensed Chef products - Implemented license_id parameter for install scripts and API calls - Added trial API automatic defaults enforcement (stable channel, latest version only with warnings) @@ -284,10 +285,11 @@ The library includes sophisticated platform version compatibility logic: - Fallback: Constructs filename from platform metadata if extraction fails - Renames temp file to extracted/constructed filename - Works with all download methods: wget, curl, fetch, perl, python -- **Chef-ICE Support**: Includes platform normalization and package manager detection functions - - `determine_package_manager()` - Detects package format based on platform - - `normalize_platform_name()` - Maps specific platforms to generic categories (linux, macos, windows, unix) - - Conditional URL construction based on product type (chef-ice vs. standard products) +- **Package Manager Override (`-i` flag)**: Optional flag for explicit pm control + - Default: omitted — server derives `pm` from platform automatically + - When `-i ` is passed, appends `&pm=` to the metadata URL + - No client-side `determine_package_manager()` or `normalize_platform_name()` functions + - Single unified metadata URL for all products, including chef-ice and inspec-enterprise ### PowerShell (install.ps1) - Supports: http_proxy @@ -304,10 +306,10 @@ The library includes sophisticated platform version compatibility logic: - Parses JSON responses with `ConvertFrom-Json` - Extracts `url` and `sha256` from JSON object - Automatically routes to trial or commercial API based on license_id prefix -- **Chef-ICE Support**: Simplified parameters for Windows - - Uses `p=windows`, `m=`, `pm=msi` parameters for chef-ice - - Conditional logic to select appropriate metadata URL format based on product type - - Handles both chef-ice and standard product URL construction +- **Package Manager Override (`$package_manager`)**: Optional parameter for explicit pm control + - Default: empty — server derives `pm` from platform automatically + - When non-empty, appends `&pm=` to the metadata URL + - No product-specific conditional URL branches; single unified URL for all products ### Script Options - `download_url_override`: Direct URL instead of API lookup @@ -316,6 +318,7 @@ The library includes sophisticated platform version compatibility logic: - `license_id`: License ID for commercial/trial API access (format: `free-*`, `trial-*`, or standard license ID) - `base_api_url` (shell): Override API endpoint (optional, auto-detected from license_id if not provided) - `base_server_uri` (PowerShell): Override API endpoint (optional, auto-detected from license_id if not provided) +- `-i ` / `$package_manager`: Explicit package manager override (e.g. `msi`, `zip`). Omit to let the server derive it from platform. Appends `&pm=` to the metadata URL when set. ## API Usage Patterns diff --git a/spec/unit/mixlib/install/generator_spec.rb b/spec/unit/mixlib/install/generator_spec.rb index 568a87f9..19278b79 100644 --- a/spec/unit/mixlib/install/generator_spec.rb +++ b/spec/unit/mixlib/install/generator_spec.rb @@ -617,7 +617,7 @@ it "builds pm_param only when package_manager is supplied" do expect(install_script).to include('$pm_param = ""') - expect(install_script).to include('-not [string]::IsNullOrEmpty($package_manager)') + expect(install_script).to include("-not [string]::IsNullOrEmpty($package_manager)") expect(install_script).to include('$pm_param = "&pm=$package_manager"') end @@ -676,7 +676,7 @@ end it "appends pm_param only when package_manager is explicitly set" do - expect(install_script).to include('-not [string]::IsNullOrEmpty($package_manager)') + expect(install_script).to include("-not [string]::IsNullOrEmpty($package_manager)") expect(install_script).to include('$pm_param = "&pm=$package_manager"') end end @@ -702,7 +702,7 @@ end it "only adds pm param when package_manager is non-empty" do - expect(install_script).to include('-not [string]::IsNullOrEmpty($package_manager)') + expect(install_script).to include("-not [string]::IsNullOrEmpty($package_manager)") expect(install_script).to include('$pm_param = "&pm=$package_manager"') end end From 7d1f8c4e293844e94c39e43734d70414aa6c3b30 Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Tue, 12 May 2026 18:48:23 -0500 Subject: [PATCH 3/3] fix unit tests Signed-off-by: Corey Hemminger --- spec/unit/mixlib/install/product_spec.rb | 1 + spec/unit/mixlib/install_spec.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/unit/mixlib/install/product_spec.rb b/spec/unit/mixlib/install/product_spec.rb index 00c5ecb9..945af4f2 100644 --- a/spec/unit/mixlib/install/product_spec.rb +++ b/spec/unit/mixlib/install/product_spec.rb @@ -150,6 +150,7 @@ ha harmony inspec + inspec-enterprise mac-bootstrapper manage marketplace diff --git a/spec/unit/mixlib/install_spec.rb b/spec/unit/mixlib/install_spec.rb index 94d088b3..bfd27522 100644 --- a/spec/unit/mixlib/install_spec.rb +++ b/spec/unit/mixlib/install_spec.rb @@ -174,7 +174,7 @@ end it "should render a script with cli parameters" do - expect(install_sh).to include("while getopts pnv:b:c:f:P:d:s:l:a:L: opt") + expect(install_sh).to include("while getopts pnv:b:c:f:P:d:s:l:a:L:i: opt") end context "with custom base_url" do