Skip to content

salt provisioning fails if a version is specified when bootstraping windows instances #298

@muddman

Description

@muddman

If you specify a version with salt_version when installing on a windows instance, the minion installation fails because bootstrap_options are set to config[:salt_bootstrap_options] = "-P git v#{salt_version}" and, -P is not a valid command line option to the bootstrap-salt.ps1 powershell script.

provisioner:
  name: salt_solo
  salt_install: bootstrap
  salt_version: 2019.2.2
-----> Starting Kitchen (v1.23.2)
-----> Converging <default-windows-2016>...
       Preparing files for transfer
       Preparing salt-minion
       Preparing pillars into /srv/pillar
       Preparing state collection
       Preparing state_top
       Preparing scripts into /etc/salt/scripts
           Directory: C:\
       Mode                LastWriteTime         Length Name
       ----                -------------         ------ ----
       d-----       12/11/2019   8:23 AM                temp
       No salt-minion installed, install must have failed!!
       salt_install = bootstrap
       salt_url = https://raw.githubusercontent.com/saltstack/salt-bootstrap/develop/bootstrap-salt.ps1
       bootstrap_options = -P git v2019.2.2
...
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>>     Converge failed on instance <default-windows-2016>.  Please see .kitchen/logs/default-windows-2016.log for more details
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

The code is on line 140 of kitchen-salt/lib/kitchen/provisioner/salt_solo.rb.

def setup_salt
        debug(diagnose)
        salt_version = config[:salt_version]

        # if salt_verison is set, bootstrap is being used & bootstrap_options is empty,
        # set the bootstrap_options string to git install the requested version
        if (salt_version != 'latest') && (config[:salt_install] == 'bootstrap') && config[:salt_bootstrap_options].empty?
          debug("Using bootstrap git to install #{salt_version}")
          config[:salt_bootstrap_options] = "-P git v#{salt_version}"
        end

The workaround is to specific the bootstrap_options:

provisioner:
  name: salt_solo
  salt_install: bootstrap
  salt_bootstrap_options: '-version 2019.2.2'
  salt_version: latest

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions