mirror of
https://github.com/saltstack-formulas/packages-formula.git
synced 2025-04-10 14:51:42 +00:00
test: standardise use of share
suite & _mapdata
state [skip ci]
* Automated using https://github.com/myii/ssf-formula/pull/302
This commit is contained in:
parent
c2e9774dc7
commit
79257d555a
8 changed files with 52 additions and 4 deletions
|
@ -7,7 +7,7 @@ Layout/LineLength:
|
|||
# Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`)
|
||||
Max: 88
|
||||
Metrics/BlockLength:
|
||||
ExcludedMethods:
|
||||
IgnoredMethods:
|
||||
- control
|
||||
- describe
|
||||
# Increase from default of `25`
|
||||
|
|
2
Gemfile
2
Gemfile
|
@ -5,7 +5,7 @@ source 'https://rubygems.org'
|
|||
# Use the latest version of `inspec` prior to `4.23.4`, which introduces a
|
||||
# regression where the diff isn't displayed when comparing using `eq`.
|
||||
gem 'inspec', '~> 4.22.22'
|
||||
# Install the `kitchen-docker` gem from GitHub because the latest version
|
||||
# Install the `kitchen-docker` gem using `git` because the latest version
|
||||
# currently available (`2.10.0`) doesn't include a recent fix for Gentoo.
|
||||
# rubocop:disable Layout/LineLength
|
||||
gem 'kitchen-docker', git: 'https://gitlab.com/saltstack-formulas/infrastructure/kitchen-docker', branch: 'ssf'
|
||||
|
|
|
@ -367,6 +367,7 @@ suites:
|
|||
state_top:
|
||||
base:
|
||||
'*':
|
||||
- packages._mapdata
|
||||
- node
|
||||
- packages
|
||||
pillars:
|
||||
|
@ -405,6 +406,7 @@ suites:
|
|||
state_top:
|
||||
base:
|
||||
'*':
|
||||
- packages._mapdata
|
||||
- golang.package
|
||||
- packages
|
||||
pillars:
|
||||
|
@ -429,6 +431,7 @@ suites:
|
|||
state_top:
|
||||
base:
|
||||
'*':
|
||||
- packages._mapdata
|
||||
- packages
|
||||
pillars:
|
||||
top.sls:
|
||||
|
@ -460,6 +463,7 @@ suites:
|
|||
state_top:
|
||||
base:
|
||||
'*':
|
||||
- packages._mapdata
|
||||
- epel
|
||||
- packages
|
||||
pillars:
|
||||
|
@ -492,6 +496,7 @@ suites:
|
|||
state_top:
|
||||
base:
|
||||
'*':
|
||||
- packages._mapdata
|
||||
- epel
|
||||
- packages
|
||||
pillars:
|
||||
|
@ -519,6 +524,7 @@ suites:
|
|||
state_top:
|
||||
base:
|
||||
'*':
|
||||
- packages._mapdata
|
||||
- epel
|
||||
- packages
|
||||
pillars:
|
||||
|
@ -544,6 +550,7 @@ suites:
|
|||
state_top:
|
||||
base:
|
||||
'*':
|
||||
- packages._mapdata
|
||||
- packages
|
||||
pillars:
|
||||
top.sls:
|
||||
|
@ -564,6 +571,7 @@ suites:
|
|||
state_top:
|
||||
base:
|
||||
'*':
|
||||
- packages._mapdata
|
||||
- packages
|
||||
pillars:
|
||||
top.sls:
|
||||
|
@ -589,6 +597,7 @@ suites:
|
|||
state_top:
|
||||
base:
|
||||
'*':
|
||||
- packages._mapdata
|
||||
- packages
|
||||
pillars:
|
||||
top.sls:
|
||||
|
|
13
packages/_mapdata/_mapdata.jinja
Normal file
13
packages/_mapdata/_mapdata.jinja
Normal file
|
@ -0,0 +1,13 @@
|
|||
# yamllint disable rule:indentation rule:line-length
|
||||
# {{ grains.get("osfinger", grains.os) }}
|
||||
---
|
||||
{#- use salt.slsutil.serialize to avoid encoding errors on some platforms #}
|
||||
{{ salt["slsutil.serialize"](
|
||||
"yaml",
|
||||
map,
|
||||
default_flow_style=False,
|
||||
allow_unicode=True,
|
||||
)
|
||||
| regex_replace("^\s+'$", "'", multiline=True)
|
||||
| trim
|
||||
}}
|
22
packages/_mapdata/init.sls
Normal file
22
packages/_mapdata/init.sls
Normal file
|
@ -0,0 +1,22 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
---
|
||||
{#- Get the `tplroot` from `tpldir` #}
|
||||
{%- set tplroot = tpldir.split("/")[0] %}
|
||||
{%- from tplroot ~ "/map.jinja" import packages with context %}
|
||||
|
||||
{%- set _mapdata = {
|
||||
"values": packages,
|
||||
} %}
|
||||
{%- do salt["log.debug"]("### MAP.JINJA DUMP ###\n" ~ _mapdata | yaml(False)) %}
|
||||
|
||||
{%- set output_dir = "/temp" if grains.os_family == "Windows" else "/tmp" %}
|
||||
{%- set output_file = output_dir ~ "/salt_mapdata_dump.yaml" %}
|
||||
|
||||
{{ tplroot }}-mapdata-dump:
|
||||
file.managed:
|
||||
- name: {{ output_file }}
|
||||
- source: salt://{{ tplroot }}/_mapdata/_mapdata.jinja
|
||||
- template: jinja
|
||||
- context:
|
||||
map: {{ _mapdata | yaml }}
|
|
@ -17,6 +17,7 @@ supports:
|
|||
- platform-name: opensuse
|
||||
- platform-name: suse
|
||||
- platform-name: freebsd
|
||||
- platform-name: openbsd
|
||||
- platform-name: amazon
|
||||
- platform-name: oracle
|
||||
- platform-name: arch
|
||||
|
|
|
@ -14,6 +14,7 @@ supports:
|
|||
- platform-name: opensuse
|
||||
- platform-name: suse
|
||||
- platform-name: freebsd
|
||||
- platform-name: openbsd
|
||||
- platform-name: amazon
|
||||
- platform-name: oracle
|
||||
- platform-name: arch
|
||||
|
|
|
@ -38,8 +38,8 @@ class SystemResource < Inspec.resource(1)
|
|||
case inspec.platform[:name]
|
||||
when 'amazon', 'oracle'
|
||||
"#{inspec.platform[:name]}linux"
|
||||
when 'windows_8.1_pro', 'windows_server_2019_datacenter'
|
||||
'windows'
|
||||
when /^windows_/
|
||||
inspec.platform[:family]
|
||||
else
|
||||
inspec.platform[:name]
|
||||
end
|
||||
|
@ -63,6 +63,8 @@ class SystemResource < Inspec.resource(1)
|
|||
'8.1'
|
||||
when 'windows_server_2019_datacenter'
|
||||
'2019-server'
|
||||
when 'windows_server_2016_datacenter'
|
||||
'2016-server'
|
||||
else
|
||||
inspec.platform[:release]
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue