0
0
mirror of https://github.com/saltstack-formulas/salt-formula.git synced 2026-06-27 08:26:39 +02:00

Merge pull request #591 from propertyguru/fix-kitchen-salt-version-pin

test: fix failing kitchen suites by pinning salt to the image version
This commit is contained in:
Dafydd Jones 2026-06-27 00:58:34 +01:00 committed by GitHub
commit 4aa332d167
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View File

@ -24,6 +24,8 @@ control 'salt._mapdata' do
# Load the mapdata from profile, into a YAML structure
# https://docs.chef.io/inspec/profiles/#profile-files
mapdata_file_yaml = YAML.load(inspec.profile.file(mapdata_file_path))
# salt_settings.version is pinned to the kitchen image's salt, so drop it
mapdata_file_yaml.dig('values', 'salt_settings')&.delete('version')
# Dump the YAML back into a string for comparison
mapdata_file_dump = YAML.dump(mapdata_file_yaml)
@ -36,6 +38,8 @@ control 'salt._mapdata' do
# Load the output into a YAML structure using InSpec's `yaml` resource
# https://github.com/inspec/inspec/blob/49b7d10/lib/inspec/resources/yaml.rb#L29
output_file_yaml = yaml(output_file_path).params
# drop the image-pinned salt_settings.version here too
output_file_yaml.dig('values', 'salt_settings')&.delete('version')
# Dump the YAML back into a string for comparison
output_file_dump = YAML.dump(output_file_yaml)

View File

@ -3,6 +3,11 @@
---
salt:
py_ver: 'py3'
# Pin to the salt version baked into the kitchen image so salt.minion/salt.master
# don't upgrade it to the repo's "latest" in place mid-converge — swapping the
# running onedir breaks the post-install module refresh, which raises:
# ModuleNotFoundError: spec not found for the module 'site'
version: "{{ salt['grains.get']('saltversion') }}"
# Override used for FreeBSD minion service
retry_options:
attempts: 5