Skip to content
Snippets Groups Projects
Unverified Commit 34e4bb28 authored by Imran Iqbal's avatar Imran Iqbal
Browse files

chore: standardise structure [skip ci]

* Semi-automated using https://github.com/myii/ssf-formula/pull/317
* Finalises #66
parent ab297a56
No related branches found
No related tags found
No related merge requests found
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
# `image` # `image`
image_commitlint: &image_commitlint 'myii/ssf-commitlint:11' image_commitlint: &image_commitlint 'myii/ssf-commitlint:11'
image_dindruby: &image_dindruby 'myii/ssf-dind-ruby:2.7.1-r3' image_dindruby: &image_dindruby 'myii/ssf-dind-ruby:2.7.1-r3'
image_dindrubybionic: &image_dindrubybionic 'myii/ssf-dind-ruby-bionic:1_2.5.1'
image_precommit: &image_precommit image_precommit: &image_precommit
name: 'myii/ssf-pre-commit:2.9.2' name: 'myii/ssf-pre-commit:2.9.2'
entrypoint: ['/bin/bash', '-c'] entrypoint: ['/bin/bash', '-c']
...@@ -130,7 +129,7 @@ rubocop: ...@@ -130,7 +129,7 @@ rubocop:
# default-ubuntu-1804-tiamat-py3: {extends: '.test_instance'} # default-ubuntu-1804-tiamat-py3: {extends: '.test_instance'}
# default-ubuntu-1604-tiamat-py3: {extends: '.test_instance'} # default-ubuntu-1604-tiamat-py3: {extends: '.test_instance'}
# default-centos-8-tiamat-py3: {extends: '.test_instance'} # default-centos-8-tiamat-py3: {extends: '.test_instance'}
### default-centos-7-tiamat-py3: {extends: '.test_instance'} # default-centos-7-tiamat-py3: {extends: '.test_instance'}
# default-amazonlinux-2-tiamat-py3: {extends: '.test_instance'} # default-amazonlinux-2-tiamat-py3: {extends: '.test_instance'}
# default-oraclelinux-8-tiamat-py3: {extends: '.test_instance'} # default-oraclelinux-8-tiamat-py3: {extends: '.test_instance'}
# default-oraclelinux-7-tiamat-py3: {extends: '.test_instance'} # default-oraclelinux-7-tiamat-py3: {extends: '.test_instance'}
...@@ -139,8 +138,8 @@ default-debian-10-master-py3: {extends: '.test_instance'} ...@@ -139,8 +138,8 @@ default-debian-10-master-py3: {extends: '.test_instance'}
default-ubuntu-2004-master-py3: {extends: '.test_instance'} default-ubuntu-2004-master-py3: {extends: '.test_instance'}
default-ubuntu-1804-master-py3: {extends: '.test_instance'} default-ubuntu-1804-master-py3: {extends: '.test_instance'}
# default-ubuntu-1604-master-py3: {extends: '.test_instance'} # default-ubuntu-1604-master-py3: {extends: '.test_instance'}
default-centos-8-master-py3: {extends: '.test_instance'} # default-centos-8-master-py3: {extends: '.test_instance'}
default-centos-7-master-py3: {extends: '.test_instance'} # default-centos-7-master-py3: {extends: '.test_instance'}
default-fedora-33-master-py3: {extends: '.test_instance'} default-fedora-33-master-py3: {extends: '.test_instance'}
default-fedora-32-master-py3: {extends: '.test_instance'} default-fedora-32-master-py3: {extends: '.test_instance'}
# default-opensuse-leap-152-master-py3: {extends: '.test_instance'} # default-opensuse-leap-152-master-py3: {extends: '.test_instance'}
...@@ -148,23 +147,23 @@ default-fedora-32-master-py3: {extends: '.test_instance'} ...@@ -148,23 +147,23 @@ default-fedora-32-master-py3: {extends: '.test_instance'}
# default-amazonlinux-2-master-py3: {extends: '.test_instance'} # default-amazonlinux-2-master-py3: {extends: '.test_instance'}
# default-oraclelinux-8-master-py3: {extends: '.test_instance'} # default-oraclelinux-8-master-py3: {extends: '.test_instance'}
# default-oraclelinux-7-master-py3: {extends: '.test_instance'} # default-oraclelinux-7-master-py3: {extends: '.test_instance'}
# gentoo-gentoo-stage3-latest-master-py3: {extends: '.test_instance'} # default-gentoo-stage3-latest-master-py3: {extends: '.test_instance'}
# gentoo-gentoo-stage3-systemd-master-py3: {extends: '.test_instance'} # default-gentoo-stage3-systemd-master-py3: {extends: '.test_instance'}
# default-debian-10-3002-5-py3: {extends: '.test_instance'} # default-debian-10-3002-5-py3: {extends: '.test_instance'}
# default-debian-9-3002-5-py3: {extends: '.test_instance'} # default-debian-9-3002-5-py3: {extends: '.test_instance'}
# default-ubuntu-2004-3002-5-py3: {extends: '.test_instance'} # default-ubuntu-2004-3002-5-py3: {extends: '.test_instance'}
# default-ubuntu-1804-3002-5-py3: {extends: '.test_instance'} # default-ubuntu-1804-3002-5-py3: {extends: '.test_instance'}
# default-ubuntu-1604-3002-5-py3: {extends: '.test_instance'} # default-ubuntu-1604-3002-5-py3: {extends: '.test_instance'}
# default-centos-8-3002-5-py3: {extends: '.test_instance'} # default-centos-8-3002-5-py3: {extends: '.test_instance'}
### default-centos-7-3002-5-py3: {extends: '.test_instance'} # default-centos-7-3002-5-py3: {extends: '.test_instance'}
# default-fedora-33-3002-5-py3: {extends: '.test_instance'} # default-fedora-33-3002-5-py3: {extends: '.test_instance'}
# default-fedora-32-3002-5-py3: {extends: '.test_instance'} # default-fedora-32-3002-5-py3: {extends: '.test_instance'}
# default-amazonlinux-2-3002-5-py3: {extends: '.test_instance'} # default-amazonlinux-2-3002-5-py3: {extends: '.test_instance'}
# default-oraclelinux-8-3002-5-py3: {extends: '.test_instance'} # default-oraclelinux-8-3002-5-py3: {extends: '.test_instance'}
# default-oraclelinux-7-3002-5-py3: {extends: '.test_instance'} # default-oraclelinux-7-3002-5-py3: {extends: '.test_instance'}
# default-arch-base-latest-3002-5-py3: {extends: '.test_instance'} # default-arch-base-latest-3002-5-py3: {extends: '.test_instance'}
# gentoo-gentoo-stage3-latest-3002-5-py3: {extends: '.test_instance'} # default-gentoo-stage3-latest-3002-5-py3: {extends: '.test_instance'}
# gentoo-gentoo-stage3-systemd-3002-5-py3: {extends: '.test_instance'} # default-gentoo-stage3-systemd-3002-5-py3: {extends: '.test_instance'}
# default-opensuse-leap-152-3002-2-py3: {extends: '.test_instance'} # default-opensuse-leap-152-3002-2-py3: {extends: '.test_instance'}
# default-opensuse-tmbl-latest-3002-2-py3: {extends: '.test_instance'} # default-opensuse-tmbl-latest-3002-2-py3: {extends: '.test_instance'}
# default-debian-10-3001-6-py3: {extends: '.test_instance'} # default-debian-10-3001-6-py3: {extends: '.test_instance'}
...@@ -182,8 +181,8 @@ default-fedora-32-master-py3: {extends: '.test_instance'} ...@@ -182,8 +181,8 @@ default-fedora-32-master-py3: {extends: '.test_instance'}
# default-oraclelinux-8-3001-6-py3: {extends: '.test_instance'} # default-oraclelinux-8-3001-6-py3: {extends: '.test_instance'}
# default-oraclelinux-7-3001-6-py3: {extends: '.test_instance'} # default-oraclelinux-7-3001-6-py3: {extends: '.test_instance'}
# default-arch-base-latest-3001-6-py3: {extends: '.test_instance'} # default-arch-base-latest-3001-6-py3: {extends: '.test_instance'}
# gentoo-gentoo-stage3-latest-3001-6-py3: {extends: '.test_instance'} # default-gentoo-stage3-latest-3001-6-py3: {extends: '.test_instance'}
# gentoo-gentoo-stage3-systemd-3001-6-py3: {extends: '.test_instance'} # default-gentoo-stage3-systemd-3001-6-py3: {extends: '.test_instance'}
# default-debian-10-3000-8-py3: {extends: '.test_instance'} # default-debian-10-3000-8-py3: {extends: '.test_instance'}
# default-debian-9-3000-8-py3: {extends: '.test_instance'} # default-debian-9-3000-8-py3: {extends: '.test_instance'}
# default-ubuntu-1804-3000-8-py3: {extends: '.test_instance'} # default-ubuntu-1804-3000-8-py3: {extends: '.test_instance'}
...@@ -194,8 +193,8 @@ default-fedora-32-master-py3: {extends: '.test_instance'} ...@@ -194,8 +193,8 @@ default-fedora-32-master-py3: {extends: '.test_instance'}
# default-amazonlinux-2-3000-8-py3: {extends: '.test_instance'} # default-amazonlinux-2-3000-8-py3: {extends: '.test_instance'}
# default-oraclelinux-8-3000-8-py3: {extends: '.test_instance'} # default-oraclelinux-8-3000-8-py3: {extends: '.test_instance'}
# default-oraclelinux-7-3000-8-py3: {extends: '.test_instance'} # default-oraclelinux-7-3000-8-py3: {extends: '.test_instance'}
# gentoo-gentoo-stage3-latest-3000-8-py3: {extends: '.test_instance'} # default-gentoo-stage3-latest-3000-8-py3: {extends: '.test_instance'}
# gentoo-gentoo-stage3-systemd-3000-8-py3: {extends: '.test_instance'} # default-gentoo-stage3-systemd-3000-8-py3: {extends: '.test_instance'}
# default-ubuntu-1804-3000-8-py2: {extends: '.test_instance'} # default-ubuntu-1804-3000-8-py2: {extends: '.test_instance'}
# default-ubuntu-1604-3000-8-py2: {extends: '.test_instance'} # default-ubuntu-1604-3000-8-py2: {extends: '.test_instance'}
# default-arch-base-latest-3000-8-py2: {extends: '.test_instance'} # default-arch-base-latest-3000-8-py2: {extends: '.test_instance'}
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
Layout/LineLength: Layout/LineLength:
# Increase from default of `80` # Increase from default of `80`
# Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`) # Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`)
Max: 98 Max: 88
Metrics/BlockLength: Metrics/BlockLength:
IgnoredMethods: IgnoredMethods:
- control - control
......
...@@ -93,38 +93,22 @@ jobs: ...@@ -93,38 +93,22 @@ jobs:
# - env: INSTANCE=default-amazonlinux-2-tiamat-py3 # - env: INSTANCE=default-amazonlinux-2-tiamat-py3
# - env: INSTANCE=default-oraclelinux-8-tiamat-py3 # - env: INSTANCE=default-oraclelinux-8-tiamat-py3
# - env: INSTANCE=default-oraclelinux-7-tiamat-py3 # - env: INSTANCE=default-oraclelinux-7-tiamat-py3
# - env: INSTANCE=default-debian-10-master-py3 - env: INSTANCE=default-debian-10-master-py3
- env: INSTANCE=latest-debian-10-master-py3 # - env: INSTANCE=default-debian-9-master-py3
- env: INSTANCE=default-debian-9-master-py3
# - env: INSTANCE=latest-debian-9-master-py3
- env: INSTANCE=default-ubuntu-2004-master-py3 - env: INSTANCE=default-ubuntu-2004-master-py3
# - env: INSTANCE=latest-ubuntu-2004-master-py3
- env: INSTANCE=default-ubuntu-1804-master-py3 - env: INSTANCE=default-ubuntu-1804-master-py3
# - env: INSTANCE=latest-ubuntu-1804-master-py3 # - env: INSTANCE=default-ubuntu-1604-master-py3
- env: INSTANCE=default-ubuntu-1604-master-py3
# - env: INSTANCE=latest-ubuntu-1604-master-py3
# - env: INSTANCE=default-centos-8-master-py3 # - env: INSTANCE=default-centos-8-master-py3
# - env: INSTANCE=latest-centos-8-master-py3 # - env: INSTANCE=default-centos-7-master-py3
- env: INSTANCE=default-centos-7-master-py3 - env: INSTANCE=default-fedora-33-master-py3
# - env: INSTANCE=latest-centos-7-master-py3
# - env: INSTANCE=default-fedora-33-master-py3
- env: INSTANCE=latest-fedora-33-master-py3
- env: INSTANCE=default-fedora-32-master-py3 - env: INSTANCE=default-fedora-32-master-py3
# - env: INSTANCE=latest-fedora-32-master-py3
# - env: INSTANCE=default-opensuse-leap-152-master-py3 # - env: INSTANCE=default-opensuse-leap-152-master-py3
# - env: INSTANCE=latest-opensuse-leap-152-master-py3
# - env: INSTANCE=default-opensuse-tmbl-latest-master-py3 # - env: INSTANCE=default-opensuse-tmbl-latest-master-py3
# - env: INSTANCE=latest-opensuse-tmbl-latest-master-py3
# - env: INSTANCE=default-amazonlinux-2-master-py3 # - env: INSTANCE=default-amazonlinux-2-master-py3
# - env: INSTANCE=latest-amazonlinux-2-master-py3
# - env: INSTANCE=default-oraclelinux-8-master-py3 # - env: INSTANCE=default-oraclelinux-8-master-py3
# - env: INSTANCE=latest-oraclelinux-8-master-py3
# - env: INSTANCE=default-oraclelinux-7-master-py3 # - env: INSTANCE=default-oraclelinux-7-master-py3
# - env: INSTANCE=latest-oraclelinux-7-master-py3
# - env: INSTANCE=default-gentoo-stage3-latest-master-py3 # - env: INSTANCE=default-gentoo-stage3-latest-master-py3
# - env: INSTANCE=latest-gentoo-stage3-latest-master-py3
# - env: INSTANCE=default-gentoo-stage3-systemd-master-py3 # - env: INSTANCE=default-gentoo-stage3-systemd-master-py3
# - env: INSTANCE=latest-gentoo-stage3-systemd-master-py3
# - env: INSTANCE=default-debian-10-3002-5-py3 # - env: INSTANCE=default-debian-10-3002-5-py3
# - env: INSTANCE=default-debian-9-3002-5-py3 # - env: INSTANCE=default-debian-9-3002-5-py3
# - env: INSTANCE=default-ubuntu-2004-3002-5-py3 # - env: INSTANCE=default-ubuntu-2004-3002-5-py3
...@@ -138,7 +122,6 @@ jobs: ...@@ -138,7 +122,6 @@ jobs:
# - env: INSTANCE=default-oraclelinux-8-3002-5-py3 # - env: INSTANCE=default-oraclelinux-8-3002-5-py3
# - env: INSTANCE=default-oraclelinux-7-3002-5-py3 # - env: INSTANCE=default-oraclelinux-7-3002-5-py3
# - env: INSTANCE=default-arch-base-latest-3002-5-py3 # - env: INSTANCE=default-arch-base-latest-3002-5-py3
# - env: INSTANCE=latest-arch-base-latest-3002-5-py3
# - env: INSTANCE=default-gentoo-stage3-latest-3002-5-py3 # - env: INSTANCE=default-gentoo-stage3-latest-3002-5-py3
# - env: INSTANCE=default-gentoo-stage3-systemd-3002-5-py3 # - env: INSTANCE=default-gentoo-stage3-systemd-3002-5-py3
# - env: INSTANCE=default-opensuse-leap-152-3002-2-py3 # - env: INSTANCE=default-opensuse-leap-152-3002-2-py3
......
...@@ -18,7 +18,6 @@ ignore: | ...@@ -18,7 +18,6 @@ ignore: |
test/**/states/**/*.sls test/**/states/**/*.sls
.kitchen/ .kitchen/
kitchen.vagrant.yml kitchen.vagrant.yml
pillar.example
yaml-files: yaml-files:
# Default settings # Default settings
......
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners # https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners
# SECTION: Owner(s) for everything in the repo, unless a later match takes precedence # SECTION: Owner(s) for everything in the repo, unless a later match takes precedence
# **************************************************************************
# *** NO GLOBAL OWNER(S) SPECIFIED ***
# *** Ideally this will be defined for a healthy, well-maintained repo ***
# **************************************************************************
# FILE PATTERN OWNER(S) # FILE PATTERN OWNER(S)
* @NONE * @NONE
......
module.exports = { module.exports = {
extends: ['@commitlint/config-conventional'], extends: ['@commitlint/config-conventional'],
rules: { rules: {
'body-max-line-length': [2, 'always', 1120], 'body-max-line-length': [2, 'always', 120],
'footer-max-line-length': [2, 'always', 584], 'footer-max-line-length': [2, 'always', 120],
'header-max-length': [2, 'always', 82], 'header-max-length': [2, 'always', 72],
}, },
}; };
...@@ -308,16 +308,12 @@ verifier: ...@@ -308,16 +308,12 @@ verifier:
suites: suites:
- name: default - name: default
excludes:
- gentoo-stage3-latest-master-py3
- gentoo-stage3-systemd-master-py3
- gentoo-stage3-latest-3002-5-py3
- gentoo-stage3-systemd-3002-5-py3
- gentoo-stage3-latest-3001-6-py3
- gentoo-stage3-systemd-3001-6-py3
- gentoo-stage3-latest-3000-8-py3
- gentoo-stage3-systemd-3000-8-py3
provisioner: provisioner:
dependencies:
- name: files
path: ./test/salt
- name: states
path: ./test/salt
state_top: state_top:
base: base:
'*': '*':
...@@ -329,15 +325,8 @@ suites: ...@@ -329,15 +325,8 @@ suites:
base: base:
'*': '*':
- rabbitmq - rabbitmq
- define_roles
pillars_from_files: pillars_from_files:
rabbitmq.sls: pillar.example rabbitmq.sls: pillar.example
define_roles.sls: test/salt/pillar/define_roles.sls
dependencies:
- name: files
path: ./test/salt
- name: states
path: ./test/salt
verifier: verifier:
inspec_tests: inspec_tests:
- path: test/integration/default - path: test/integration/default
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: ft=sls # vim: ft=sls
--- ---
{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split("/")[0] %} {%- set tplroot = tpldir.split("/")[0] %}
{%- from tplroot ~ "/map.jinja" import mapdata with context %} {%- from tplroot ~ "/map.jinja" import mapdata with context %}
......
# frozen_string_literal: true
require 'yaml'
control 'rabbitmq._mapdata' do
title '`map.jinja` should match the reference file'
### Method
# The steps below for each file appear convoluted but they are both required
# and similar in nature:
# 1. The earliest method was to simply compare the files textually but this often
# led to false positives due to inconsistencies (e.g. spacing, ordering)
# 2. The next method was to load the files back into YAML structures and then
# compare but InSpec provided block diffs this way, unusable by end users
# 3. The final step was to dump the YAML structures back into a string to use
# for the comparison; this both worked and provided human-friendly diffs
### Comparison file for the specific platform
### Static, adjusted as part of code contributions, as map data is changed
# Strip the `platform[:finger]` version number down to the "OS major release"
platform_finger = system.platform[:finger].split('.').first.to_s
# Use that to set the path to the file (relative to the InSpec suite directory)
mapdata_file_path = "_mapdata/#{platform_finger}.yaml"
# 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))
# Dump the YAML back into a string for comparison
mapdata_file_dump = YAML.dump(mapdata_file_yaml)
### Output file produced by running the `_mapdata` state
### Dynamic, generated during Kitchen's `converge` phase
# Derive the location of the dumped mapdata (differs for Windows)
output_dir = platform[:family] == 'windows' ? '/temp' : '/tmp'
# Use that to set the path to the file (absolute path, i.e. within the container)
output_file_path = "#{output_dir}/salt_mapdata_dump.yaml"
# 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
# Dump the YAML back into a string for comparison
output_file_dump = YAML.dump(output_file_yaml)
describe 'File content' do
it 'should match profile map data exactly' do
expect(output_file_dump).to eq(mapdata_file_dump)
end
end
end
...@@ -5,7 +5,6 @@ name: default ...@@ -5,7 +5,6 @@ name: default
title: rabbitmq formula title: rabbitmq formula
maintainer: SaltStack Formulas maintainer: SaltStack Formulas
license: Apache-2.0 license: Apache-2.0
# yamllint disable-line rule:line-length
summary: Verify that the rabbitmq formula is setup and configured correctly summary: Verify that the rabbitmq formula is setup and configured correctly
depends: depends:
- name: share - name: share
......
...@@ -56,9 +56,9 @@ class SystemResource < Inspec.resource(1) ...@@ -56,9 +56,9 @@ class SystemResource < Inspec.resource(1)
when 'gentoo' when 'gentoo'
"#{inspec.platform[:release].split('.')[0]}-#{derive_gentoo_init_system}" "#{inspec.platform[:release].split('.')[0]}-#{derive_gentoo_init_system}"
when 'opensuse' when 'opensuse'
# rubocop:disable Style/NumericLiterals # rubocop:disable Style/NumericLiterals,Layout/LineLength
inspec.platform[:release].to_i > 20210101 ? 'tumbleweed' : inspec.platform[:release] inspec.platform[:release].to_i > 20210101 ? 'tumbleweed' : inspec.platform[:release]
# rubocop:enable Style/NumericLiterals # rubocop:enable Style/NumericLiterals,Layout/LineLength
when 'windows_8.1_pro' when 'windows_8.1_pro'
'8.1' '8.1'
when 'windows_server_2019_datacenter' when 'windows_server_2019_datacenter'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment