mirror of
https://github.com/saltstack-formulas/openssh-formula.git
synced 2024-12-01 04:41:43 +01:00
0eafbd945c
We store validated `map.jinja` dump under the profile `files` directory to access them with `inspec.profile.file('filename')` to validate the content of the generated mapdata file. The YAML files contain a value specific to each minion, its hostname, so we use string format to expand `%{hostname}`. The `default` inspec profile need to depends on `share` to access the `system` and `salt_minion` libraries.
19 lines
452 B
Ruby
19 lines
452 B
Ruby
# frozen_string_literal: true
|
|
|
|
# Replace per minion strings
|
|
replacement = {
|
|
hostname: system.hostname
|
|
}
|
|
|
|
mapdata_file = "mapdata/#{system.platform[:finger].split('.').first}.yaml"
|
|
mapdata_dump = inspec.profile.file(mapdata_file) % replacement
|
|
|
|
control '`map.jinja` YAML dump' do
|
|
title 'should contain the lines'
|
|
|
|
describe file('/tmp/salt_mapdata_dump.yaml') do
|
|
it { should exist }
|
|
its('content') { should include mapdata_dump }
|
|
end
|
|
end
|