From f00c9a796a510cc50fcb52994e740866f30288a1 Mon Sep 17 00:00:00 2001 From: Imran Iqbal Date: Thu, 19 Sep 2019 01:53:31 +0100 Subject: [PATCH 1/3] fix(pkgrepo): fix settings for `opensuse` --- salt/osfamilymap.yaml | 31 ++++++++++++++++++------------- salt/pkgrepo/suse/install.sls | 3 ++- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/salt/osfamilymap.yaml b/salt/osfamilymap.yaml index a007412..24576d9 100644 --- a/salt/osfamilymap.yaml +++ b/salt/osfamilymap.yaml @@ -2,23 +2,27 @@ # vim: ft=yaml --- -{% import_yaml "salt/ospyvermap.yaml" as ospyvermap %} -{% set ospyver = salt['grains.filter_by'](ospyvermap, grain='os_family') or {} %} -{% set py_ver_repr = salt['pillar.filter_by'](ospyver, pillar='salt:py_ver', default='py2') %} +{%- import_yaml "salt/ospyvermap.yaml" as ospyvermap %} +{%- set ospyver = salt['grains.filter_by'](ospyvermap, grain='os_family') or {} %} +{%- set py_ver_repr = salt['pillar.filter_by'](ospyver, pillar='salt:py_ver', default='py2') %} -{% set osrelease = salt['grains.get']('osrelease') %} -{% set salt_release = salt['pillar.get']('salt:release', 'latest') %} -{% if salt_release.split('.')|length >= 3 %} -{% set salt_release = 'archive/' ~ salt_release %} -{% endif %} -{% set osfamily_lower = salt['grains.get']('os_family')|lower %} -{% set osmajorrelease = salt['grains.get']('osmajorrelease', osrelease)|string %} -{% set oscodename = salt['grains.get']('oscodename') %} +{%- set osrelease = salt['grains.get']('osrelease') %} +{#- Workaround for OpenSuse Leap 15.1 until the repo is available #} +{%- if [grains.os_family, osrelease] == ['Suse', '15.1'] %} +{%- set osrelease = '15.0' %} +{%- endif %} +{%- set salt_release = salt['pillar.get']('salt:release', 'latest') %} +{%- if salt_release.split('.')|length >= 3 %} +{%- set salt_release = 'archive/' ~ salt_release %} +{%- endif %} +{%- set osfamily_lower = salt['grains.get']('os_family')|lower %} +{%- set osmajorrelease = salt['grains.get']('osmajorrelease', osrelease)|string %} +{%- set oscodename = salt['grains.get']('oscodename') %} #from template-formula {%- if grains.os == 'MacOS' %} - {%- set macos_rootuser = salt['cmd.run']("stat -f '%Su' /dev/console") %} - {%- set macos_rootgroup = salt['cmd.run']("stat -f '%Sg' /dev/console") %} +{%- set macos_rootuser = salt['cmd.run']("stat -f '%Su' /dev/console") %} +{%- set macos_rootgroup = salt['cmd.run']("stat -f '%Sg' /dev/console") %} {%- endif %} Debian: @@ -53,6 +57,7 @@ RedHat: gitfs_provider: pygit2 Suse: + pkgrepo_humanname: 'Salt releases for SLE-based SUSE products (openSUSE_Leap_{{ osrelease }})' pkgrepo: 'http://repo.saltstack.com/opensuse/openSUSE_Leap_{{ osrelease }}/' key_url: 'http://repo.saltstack.com/opensuse/openSUSE_Leap_{{ osrelease }}/repodata/repomd.xml.key' pygit2: python-pygit2 diff --git a/salt/pkgrepo/suse/install.sls b/salt/pkgrepo/suse/install.sls index 115af7e..f87c105 100644 --- a/salt/pkgrepo/suse/install.sls +++ b/salt/pkgrepo/suse/install.sls @@ -5,8 +5,9 @@ salt-pkgrepo-install-saltstack-suse: pkgrepo.managed: - name: systemsmanagement_saltstack_products - - humanname: SaltStack repo for Opensuse 15.x + - humanname: {{ salt_settings.pkgrepo_humanname }} - baseurl: {{ salt_settings.pkgrepo }} - enabled: 1 - gpgcheck: 1 - gpgkey: {{ salt_settings.key_url }} + - gpgautoimport: true From cb726afb104111046984c83934bdde110572cb59 Mon Sep 17 00:00:00 2001 From: Imran Iqbal Date: Thu, 19 Sep 2019 00:19:26 +0100 Subject: [PATCH 2/3] fix(pkgrepo): provide settings for `amazon` --- salt/osfamilymap.yaml | 2 ++ salt/osmap.yaml | 6 ++++++ salt/pkgrepo/redhat/install.sls | 14 +++++++++----- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/salt/osfamilymap.yaml b/salt/osfamilymap.yaml index 24576d9..4c64e98 100644 --- a/salt/osfamilymap.yaml +++ b/salt/osfamilymap.yaml @@ -41,6 +41,8 @@ Debian: install_from_source: false RedHat: + pkgrepo_name: saltstack + pkgrepo_humanname: SaltStack repo for RHEL/CentOS $releasever pkgrepo: 'https://repo.saltstack.com/{{ py_ver_repr }}/redhat/$releasever/$basearch/{{ salt_release }}' key_url: 'https://repo.saltstack.com/{{ py_ver_repr }}/redhat/$releasever/$basearch/{{ salt_release }}/SALTSTACK-GPG-KEY.pub' pygit2: python-pygit2 diff --git a/salt/osmap.yaml b/salt/osmap.yaml index 9686416..55d16b3 100644 --- a/salt/osmap.yaml +++ b/salt/osmap.yaml @@ -19,6 +19,12 @@ Fedora: pygit2: python2-pygit2 +Amazon: + pkgrepo_name: saltstack-amzn-repo + pkgrepo_humanname: SaltStack repo for Amazon Linux 2 + pkgrepo: 'https://repo.saltstack.com/yum/amazon/2/$basearch/{{ salt_release }}' + key_url: 'https://repo.saltstack.com/yum/amazon/2/$basearch/{{ salt_release }}/SALTSTACK-GPG-KEY.pub' + Ubuntu: pkgrepo: 'deb http://repo.saltstack.com/{{ py_ver_dir }}/{{ os_lower }}/{{ osrelease }}/amd64/{{ salt_release }} {{ oscodename }} main' key_url: 'https://repo.saltstack.com/{{ py_ver_dir }}/{{ os_lower }}/{{ osrelease }}/amd64/{{ salt_release }}/SALTSTACK-GPG-KEY.pub' diff --git a/salt/pkgrepo/redhat/install.sls b/salt/pkgrepo/redhat/install.sls index 84e0092..32b8d1a 100644 --- a/salt/pkgrepo/redhat/install.sls +++ b/salt/pkgrepo/redhat/install.sls @@ -1,14 +1,18 @@ # -*- coding: utf-8 -*- # vim: ft=sls -{% from "salt/map.jinja" import salt_settings with context %} +{%- from "salt/map.jinja" import salt_settings with context %} - {%- if grains['os']|lower not in ('amazon', 'fedora') %} +{%- if grains['os']|lower not in ['fedora'] %} salt-pkgrepo-install-saltstack-redhat: pkgrepo.managed: - - name: saltstack - - humanname: SaltStack repo for RHEL/CentOS $releasever + - name: {{ salt_settings.pkgrepo_name }} + - humanname: {{ salt_settings.pkgrepo_humanname }} - baseurl: {{ salt_settings.pkgrepo }} - enabled: 1 - gpgcheck: 1 - gpgkey: {{ salt_settings.key_url }} - {% endif %} + {%- if grains['os']|lower in ['amazon'] %} + - failovermethod: priority + - priority: 10 + {%- endif %} +{%- endif %} From fc1d0b15a3d5bce9948f37a1d015692eddf9c1b3 Mon Sep 17 00:00:00 2001 From: Imran Iqbal Date: Tue, 17 Sep 2019 22:56:38 +0100 Subject: [PATCH 3/3] refactor(kitchen+travis+inspec): use pre-salted images * Semi-automated using https://github.com/myii/ssf-formula/pull/36 * Restructure all tests according to updated test suites * Improve tests where necessary (code style, new platforms and package versions) --- .travis.yml | 43 ++- kitchen.yml | 264 +++++++++--------- test/integration/develop/pkgs_spec.rb | 12 - test/integration/v201707-py2/README.md | 50 ++++ .../controls}/pkgs_spec.rb | 22 +- .../controls}/service_spec.rb | 0 test/integration/v201707-py2/inspec.yml | 17 ++ test/integration/v201803-py2/README.md | 50 ++++ .../controls}/pkgs_spec.rb | 13 +- .../controls}/service_spec.rb | 0 test/integration/v201803-py2/inspec.yml | 17 ++ test/integration/v201902-py2/README.md | 50 ++++ .../controls}/pkgs_spec.rb | 19 +- .../controls}/service_spec.rb | 0 test/integration/v201902-py2/inspec.yml | 17 ++ test/integration/v201902-py3/README.md | 50 ++++ .../v201902-py3/controls/pkgs_spec.rb | 30 ++ .../controls}/service_spec.rb | 0 test/integration/v201902-py3/inspec.yml | 17 ++ test/salt/pillar/develop-py3.sls | 6 - .../{v2017-7-py2.sls => v201707-py2.sls} | 0 .../pillar/v2018-3-py2-forced-version.sls | 7 - .../{v2018-3-py2.sls => v201803-py2.sls} | 0 .../{v2019-2-py2.sls => v201902-py2.sls} | 0 .../{v2019-2-py3.sls => v201902-py3.sls} | 0 25 files changed, 472 insertions(+), 212 deletions(-) delete mode 100644 test/integration/develop/pkgs_spec.rb create mode 100644 test/integration/v201707-py2/README.md rename test/integration/{2019-2 => v201707-py2/controls}/pkgs_spec.rb (52%) rename test/integration/{2017-7 => v201707-py2/controls}/service_spec.rb (100%) create mode 100644 test/integration/v201707-py2/inspec.yml create mode 100644 test/integration/v201803-py2/README.md rename test/integration/{2017-7 => v201803-py2/controls}/pkgs_spec.rb (67%) rename test/integration/{2018-3 => v201803-py2/controls}/service_spec.rb (100%) create mode 100644 test/integration/v201803-py2/inspec.yml create mode 100644 test/integration/v201902-py2/README.md rename test/integration/{2018-3 => v201902-py2/controls}/pkgs_spec.rb (54%) rename test/integration/{2019-2 => v201902-py2/controls}/service_spec.rb (100%) create mode 100644 test/integration/v201902-py2/inspec.yml create mode 100644 test/integration/v201902-py3/README.md create mode 100644 test/integration/v201902-py3/controls/pkgs_spec.rb rename test/integration/{develop => v201902-py3/controls}/service_spec.rb (100%) create mode 100644 test/integration/v201902-py3/inspec.yml delete mode 100644 test/salt/pillar/develop-py3.sls rename test/salt/pillar/{v2017-7-py2.sls => v201707-py2.sls} (100%) delete mode 100644 test/salt/pillar/v2018-3-py2-forced-version.sls rename test/salt/pillar/{v2018-3-py2.sls => v201803-py2.sls} (100%) rename test/salt/pillar/{v2019-2-py2.sls => v201902-py2.sls} (100%) rename test/salt/pillar/{v2019-2-py3.sls => v201902-py3.sls} (100%) diff --git a/.travis.yml b/.travis.yml index b022c51..778a844 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,31 +24,24 @@ env: # slow down the entire run at the end (i.e. `centos-6` and `opensuse`) # However, the groupings needed to be maintained in some semblance of order # so this is a best-effort matrix, in the circumstances - - # develop-py3 - - INSTANCE: develop-py3-debian-9 - - INSTANCE: develop-py3-opensuse-150 - # - INSTANCE: develop-py3-ubuntu-1804 - - # 2017.7-py2 - - INSTANCE: v2017-7-py2-bootstrap-centos-6 - # - INSTANCE: v2017-7-py2-debian-8 - - INSTANCE: v2017-7-py2-ubuntu-1604 - - # 2018.3-py2 - # - INSTANCE: v2018-3-py2-centos-7 - - INSTANCE: v2018-3-py2-debian-8 - - INSTANCE: v2018-3-py2-forced-version-fedora-29 - # - INSTANCE: v2018-3-py2-ubuntu-1604 - - # 2019.2-py2 - - INSTANCE: v2019-2-py2-centos-7 - - INSTANCE: v2019-2-py2-fedora-30 - - # 2019.2-py3 - # - INSTANCE: v2019-2-py3-debian-9 - - INSTANCE: v2019-2-py3-opensuse-150 - - INSTANCE: v2019-2-py3-ubuntu-1804 + # - INSTANCE: v201707-py2-debian-8-2017-7-py2 + - INSTANCE: v201707-py2-ubuntu-1604-2017-7-py2 + - INSTANCE: v201707-py2-centos-6-2017-7-py2 + # - INSTANCE: v201707-py2-amazonlinux-2-2017-7-py2 + # - INSTANCE: v201803-py2-debian-9-2018-3-py2 + # - INSTANCE: v201803-py2-ubuntu-1604-2018-3-py2 + - INSTANCE: v201803-py2-centos-7-2018-3-py2 + - INSTANCE: v201803-py2-amazonlinux-2-2018-3-py2 + - INSTANCE: v201902-py2-debian-9-2019-2-py2 + - INSTANCE: v201902-py2-ubuntu-1804-2019-2-py2 + # - INSTANCE: v201902-py2-centos-7-2019-2-py2 + # - INSTANCE: v201902-py2-opensuse-leap-15-2019-2-py2 + # - INSTANCE: v201902-py2-amazonlinux-2-2019-2-py2 + # - INSTANCE: v201902-py3-debian-9-2019-2-py3 + # - INSTANCE: v201902-py3-ubuntu-1804-2019-2-py3 + # - INSTANCE: v201902-py3-centos-7-2019-2-py3 + - INSTANCE: v201902-py3-fedora-30-2019-2-py3 + - INSTANCE: v201902-py3-opensuse-leap-15-2019-2-py3 script: - bin/kitchen verify ${INSTANCE} diff --git a/kitchen.yml b/kitchen.yml index 3ef6ed3..039f325 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -1,55 +1,96 @@ # -*- coding: utf-8 -*- # vim: ft=yaml --- +# For help on this file's format, see https://kitchen.ci/ driver: name: docker use_sudo: false privileged: true - provision_command: mkdir -p /run/sshd run_command: /lib/systemd/systemd +# Make sure the platforms listed below match up with +# the `env.matrix` instances defined in `.travis.yml` platforms: - # Latest distros - - name: debian-9 - - name: ubuntu-18.04 - - name: centos-7 - - name: fedora-30 - - name: opensuse-15.0 + ## SALT `2017.7` + - name: debian-8-2017-7-py2 driver: - image: opensuse/leap:15.0 + image: netmanagers/salt-2017.7-py2:debian-8 + - name: ubuntu-1604-2017-7-py2 + driver: + image: netmanagers/salt-2017.7-py2:ubuntu-16.04 + - name: centos-6-2017-7-py2 + driver: + image: netmanagers/salt-2017.7-py2:centos-6 + run_command: /sbin/init + - name: amazonlinux-2-2017-7-py2 + driver: + image: netmanagers/salt-2017.7-py2:amazonlinux-2 + + ## SALT `2018.3` + - name: debian-9-2018-3-py2 + driver: + image: netmanagers/salt-2018.3-py2:debian-9 + - name: ubuntu-1604-2018-3-py2 + driver: + image: netmanagers/salt-2018.3-py2:ubuntu-16.04 + - name: centos-7-2018-3-py2 + driver: + image: netmanagers/salt-2018.3-py2:centos-7 + - name: amazonlinux-2-2018-3-py2 + driver: + image: netmanagers/salt-2018.3-py2:amazonlinux-2 + + ## SALT `2019.2` + - name: debian-9-2019-2-py2 + driver: + image: netmanagers/salt-2019.2-py2:debian-9 + - name: ubuntu-1804-2019-2-py2 + driver: + image: netmanagers/salt-2019.2-py2:ubuntu-18.04 + - name: centos-7-2019-2-py2 + driver: + image: netmanagers/salt-2019.2-py2:centos-7 + - name: opensuse-leap-15-2019-2-py2 + driver: + image: netmanagers/salt-2019.2-py2:opensuse-leap-15 + run_command: /usr/lib/systemd/systemd + # Workaround to avoid intermittent failures on `opensuse-leap-15`: + # => SCP did not finish successfully (255): (Net::SCP::Error) + transport: + max_ssh_sessions: 1 + - name: amazonlinux-2-2019-2-py2 + driver: + image: netmanagers/salt-2019.2-py2:amazonlinux-2 + - name: debian-9-2019-2-py3 + driver: + image: netmanagers/salt-2019.2-py3:debian-9 + - name: ubuntu-1804-2019-2-py3 + driver: + image: netmanagers/salt-2019.2-py3:ubuntu-18.04 + - name: centos-7-2019-2-py3 + driver: + image: netmanagers/salt-2019.2-py3:centos-7 + - name: fedora-30-2019-2-py3 + driver: + image: netmanagers/salt-2019.2-py3:fedora-30 + - name: opensuse-leap-15-2019-2-py3 + driver: + image: netmanagers/salt-2019.2-py3:opensuse-leap-15 run_command: /usr/lib/systemd/systemd - provision_command: - - systemctl enable sshd.service # Workaround to avoid intermittent failures on `opensuse-leap-15`: # => SCP did not finish successfully (255): (Net::SCP::Error) transport: max_ssh_sessions: 1 - # Previous distros - - name: debian-8 - - name: ubuntu-16.04 - - name: fedora-29 - # centos-6 guest fails on Debian hosts due to vsyscall issues, see - # https://hub.docker.com/_/centos, "A note about vsyscall" - - name: centos-6 - driver: - run_command: /sbin/init - provisioner: name: salt_solo - salt_bootstrap_options: -X -d git %s log_level: info + salt_install: none require_chef: false formula: salt salt_copy_filter: - .kitchen - .git - state_top: - base: - '*': - - salt.pkgrepo - - salt.master - - salt.minion verifier: # https://www.inspec.io/ @@ -60,158 +101,105 @@ verifier: - cli suites: - # Latest distros, salt develop, python3 - # These distros have py3 packages available in salt's repo - - name: develop-py3 + - name: v201902-py3 includes: - - debian-9 - - ubuntu-18.04 - - opensuse-15.0 + - debian-9-2019-2-py3 + - ubuntu-1804-2019-2-py3 + - centos-7-2019-2-py3 + - fedora-30-2019-2-py3 + - opensuse-leap-15-2019-2-py3 provisioner: - salt_bootstrap_options: -X -x python3 -d git %s - salt_version: 'develop' + state_top: + base: + '*': + - salt.pkgrepo + - salt.master + - salt.minion pillars: top.sls: base: '*': - salt - - develop-py3 + - v201902-py3 pillars_from_files: salt.sls: test/salt/pillar/salt.sls - develop-py3.sls: test/salt/pillar/develop-py3.sls + v201902-py3.sls: test/salt/pillar/v201902-py3.sls verifier: inspec_tests: - - path: test/integration/develop - - # Latest distros, latest salt, python3 - # These distros have py3 packages available in salt's repo - - name: v2019-2-py3 + - path: test/integration/v201902-py3 + - name: v201902-py2 includes: - - debian-9 - - ubuntu-18.04 - - opensuse-15.0 + - debian-9-2019-2-py2 + - ubuntu-1804-2019-2-py2 + - centos-7-2019-2-py2 + - opensuse-leap-15-2019-2-py2 + - amazonlinux-2-2019-2-py2 provisioner: - salt_bootstrap_options: -X -x python3 -d git %s - salt_version: '2019.2' + state_top: + base: + '*': + - salt.pkgrepo + - salt.master + - salt.minion pillars: top.sls: base: '*': - salt - - v2019-2-py3 + - v201902-py2 pillars_from_files: salt.sls: test/salt/pillar/salt.sls - v2019-2-py3.sls: test/salt/pillar/v2019-2-py3.sls + v201902-py2.sls: test/salt/pillar/v201902-py2.sls verifier: inspec_tests: - - path: test/integration/2019-2 - - # Latest distros, latest salt, python2 - # Fedora ships updated py2 versions in their own repos - - name: v2019-2-py2 + - path: test/integration/v201902-py2 + - name: v201803-py2 includes: - - centos-7 - - fedora-30 + - debian-9-2018-3-py2 + - ubuntu-1604-2018-3-py2 + - centos-7-2018-3-py2 + - amazonlinux-2-2018-3-py2 provisioner: - salt_version: '2019.2' + state_top: + base: + '*': + - salt.pkgrepo + - salt.master + - salt.minion pillars: top.sls: base: '*': - salt - - v2019-2-py2 + - v201803-py2 pillars_from_files: salt.sls: test/salt/pillar/salt.sls - v2019-2-py2.sls: test/salt/pillar/v2019-2-py2.sls + v201803-py2.sls: test/salt/pillar/v201803-py2.sls verifier: inspec_tests: - - path: test/integration/2019-2 - - # Previous distros, previous salt, python2 - - name: v2018-3-py2 + - path: test/integration/v201803-py2 + - name: v201707-py2 includes: - - debian-8 - - ubuntu-16.04 - - centos-7 + - debian-8-2017-7-py2 + - ubuntu-1604-2017-7-py2 + - centos-6-2017-7-py2 + - amazonlinux-2-2017-7-py2 provisioner: - # We require an old version of salt in the provisioner or, - # the salt formula fails to downgrade to the desired version to test - salt_version: '2018.3' + state_top: + base: + '*': + - salt.pkgrepo + - salt.master + - salt.minion pillars: top.sls: base: '*': - salt - - v2018-3-py2 + - v201707-py2 pillars_from_files: salt.sls: test/salt/pillar/salt.sls - v2018-3-py2.sls: test/salt/pillar/v2018-3-py2.sls + v201707-py2.sls: test/salt/pillar/v201707-py2.sls verifier: inspec_tests: - - path: test/integration/2018-3 - - # To test fedora 29 & salt v2018.3, we need to force the package version - # otherwise the image, which includes the 'updates' repo, will install 2019.2 - - name: v2018-3-py2-forced-version - includes: - - fedora-29 - provisioner: - # We require an old version of salt in the provisioner or, - # the salt formula fails to downgrade to the desired version to test - salt_version: '2018.3' - pillars: - top.sls: - base: - '*': - - salt - - v2018-3-py2-forced-version - pillars_from_files: - salt.sls: test/salt/pillar/salt.sls - v2018-3-py2-forced-version.sls: test/salt/pillar/v2018-3-py2-forced-version.sls - verifier: - inspec_tests: - - path: test/integration/2018-3 - - # Previous distros, oldest salt, python2 - - name: v2017-7-py2 - includes: - - debian-8 - - ubuntu-16.04 - provisioner: - # We require an old version of salt in the provisioner or, - # the salt formula fails to downgrade to the desired version to test - salt_version: '2017.7' - pillars: - top.sls: - base: - '*': - - salt - - v2017-7-py2 - pillars_from_files: - salt.sls: test/salt/pillar/salt.sls - v2017-7-py2.sls: test/salt/pillar/v2017-7-py2.sls - verifier: - inspec_tests: - - path: test/integration/2017-7 - - # centos-6 ships with python2.6, so it requires extra bootstrapping parameters - # to install python2.7 - - name: v2017-7-py2-bootstrap - includes: - - centos-6 - provisioner: - # As centos-6 ships with python2.6, we use the bootstrapper to install python2.7 - salt_bootstrap_options: -X -d stable %s - salt_version: '2017.7' - pillars: - top.sls: - base: - '*': - - salt - - v2017-7-py2 - pillars_from_files: - salt.sls: test/salt/pillar/salt.sls - v2017-7-py2.sls: test/salt/pillar/v2017-7-py2.sls - verifier: - inspec_tests: - - path: test/integration/2017-7 + - path: test/integration/v201707-py2 diff --git a/test/integration/develop/pkgs_spec.rb b/test/integration/develop/pkgs_spec.rb deleted file mode 100644 index 7e6306c..0000000 --- a/test/integration/develop/pkgs_spec.rb +++ /dev/null @@ -1,12 +0,0 @@ -control 'salt packages' do - title 'should be installed' - - %w( - salt-master - salt-minion - ).each do |p| - describe package(p) do - it { should be_installed } - end - end -end diff --git a/test/integration/v201707-py2/README.md b/test/integration/v201707-py2/README.md new file mode 100644 index 0000000..ab6b7bb --- /dev/null +++ b/test/integration/v201707-py2/README.md @@ -0,0 +1,50 @@ +# InSpec Profile: `v201707-py2` + +This shows the implementation of the `v201707-py2` InSpec [profile](https://github.com/inspec/inspec/blob/master/docs/profiles.md). + +## Verify a profile + +InSpec ships with built-in features to verify a profile structure. + +```bash +$ inspec check v201707-py2 +Summary +------- +Location: v201707-py2 +Profile: profile +Controls: 4 +Timestamp: 2019-06-24T23:09:01+00:00 +Valid: true + +Errors +------ + +Warnings +-------- +``` + +## Execute a profile + +To run all **supported** controls on a local machine use `inspec exec /path/to/profile`. + +```bash +$ inspec exec v201707-py2 +.. + +Finished in 0.0025 seconds (files took 0.12449 seconds to load) +8 examples, 0 failures +``` + +## Execute a specific control from a profile + +To run one control from the profile use `inspec exec /path/to/profile --controls name`. + +```bash +$ inspec exec v201707-py2 --controls package +. + +Finished in 0.0025 seconds (files took 0.12449 seconds to load) +1 examples, 0 failures +``` + +See an [example control here](https://github.com/inspec/inspec/blob/master/examples/profile/controls/example.rb). diff --git a/test/integration/2019-2/pkgs_spec.rb b/test/integration/v201707-py2/controls/pkgs_spec.rb similarity index 52% rename from test/integration/2019-2/pkgs_spec.rb rename to test/integration/v201707-py2/controls/pkgs_spec.rb index c98e7b4..5ef8347 100644 --- a/test/integration/2019-2/pkgs_spec.rb +++ b/test/integration/v201707-py2/controls/pkgs_spec.rb @@ -1,13 +1,15 @@ -case os[:name] -when 'centos' - version = '2019.2.0-1.el7' -when 'fedora' - version = '2019.2.0-1.fc30' -when 'opensuse' - version = '2019.2.0-lp150.3.33.1' -when 'debian', 'ubuntu' - version = '2019.2.0+ds-1' -end +version = + case platform[:family] + when 'redhat' + case platform[:name] + when 'amazon' + '2017.7.8-1.el7' + when 'centos' + '2017.7.8-1.el6' + end + when 'debian' + '2017.7.8+ds-1' + end control 'salt packages' do title 'should be installed' diff --git a/test/integration/2017-7/service_spec.rb b/test/integration/v201707-py2/controls/service_spec.rb similarity index 100% rename from test/integration/2017-7/service_spec.rb rename to test/integration/v201707-py2/controls/service_spec.rb diff --git a/test/integration/v201707-py2/inspec.yml b/test/integration/v201707-py2/inspec.yml new file mode 100644 index 0000000..3edaedd --- /dev/null +++ b/test/integration/v201707-py2/inspec.yml @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +name: v201707-py2 +title: salt formula +maintainer: SaltStack Formulas +license: Apache-2.0 +summary: Verify that Salt `v201707-py2` is setup and configured +supports: + - platform-name: debian + - platform-name: ubuntu + - platform-name: centos + - platform-name: fedora + - platform-name: opensuse + - platform-name: suse + - platform-name: freebsd + - platform-name: amazon diff --git a/test/integration/v201803-py2/README.md b/test/integration/v201803-py2/README.md new file mode 100644 index 0000000..8311cae --- /dev/null +++ b/test/integration/v201803-py2/README.md @@ -0,0 +1,50 @@ +# InSpec Profile: `v201803-py2` + +This shows the implementation of the `v201803-py2` InSpec [profile](https://github.com/inspec/inspec/blob/master/docs/profiles.md). + +## Verify a profile + +InSpec ships with built-in features to verify a profile structure. + +```bash +$ inspec check v201803-py2 +Summary +------- +Location: v201803-py2 +Profile: profile +Controls: 4 +Timestamp: 2019-06-24T23:09:01+00:00 +Valid: true + +Errors +------ + +Warnings +-------- +``` + +## Execute a profile + +To run all **supported** controls on a local machine use `inspec exec /path/to/profile`. + +```bash +$ inspec exec v201803-py2 +.. + +Finished in 0.0025 seconds (files took 0.12449 seconds to load) +8 examples, 0 failures +``` + +## Execute a specific control from a profile + +To run one control from the profile use `inspec exec /path/to/profile --controls name`. + +```bash +$ inspec exec v201803-py2 --controls package +. + +Finished in 0.0025 seconds (files took 0.12449 seconds to load) +1 examples, 0 failures +``` + +See an [example control here](https://github.com/inspec/inspec/blob/master/examples/profile/controls/example.rb). diff --git a/test/integration/2017-7/pkgs_spec.rb b/test/integration/v201803-py2/controls/pkgs_spec.rb similarity index 67% rename from test/integration/2017-7/pkgs_spec.rb rename to test/integration/v201803-py2/controls/pkgs_spec.rb index c1c6227..37f5aae 100644 --- a/test/integration/2017-7/pkgs_spec.rb +++ b/test/integration/v201803-py2/controls/pkgs_spec.rb @@ -1,9 +1,10 @@ -case os[:name] -when 'centos' - version = '2017.7.8-1.el6' -when 'debian', 'ubuntu' - version = '2017.7.8+ds-1' -end +version = + case platform[:family] + when 'redhat' + '2018.3.4-1.el7' + when 'debian' + '2018.3.4+ds-1' + end control 'salt packages' do title 'should be installed' diff --git a/test/integration/2018-3/service_spec.rb b/test/integration/v201803-py2/controls/service_spec.rb similarity index 100% rename from test/integration/2018-3/service_spec.rb rename to test/integration/v201803-py2/controls/service_spec.rb diff --git a/test/integration/v201803-py2/inspec.yml b/test/integration/v201803-py2/inspec.yml new file mode 100644 index 0000000..4cb66af --- /dev/null +++ b/test/integration/v201803-py2/inspec.yml @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +name: v201803-py2 +title: salt formula +maintainer: SaltStack Formulas +license: Apache-2.0 +summary: Verify that Salt `v201803-py2` is setup and configured +supports: + - platform-name: debian + - platform-name: ubuntu + - platform-name: centos + - platform-name: fedora + - platform-name: opensuse + - platform-name: suse + - platform-name: freebsd + - platform-name: amazon diff --git a/test/integration/v201902-py2/README.md b/test/integration/v201902-py2/README.md new file mode 100644 index 0000000..4e4aac5 --- /dev/null +++ b/test/integration/v201902-py2/README.md @@ -0,0 +1,50 @@ +# InSpec Profile: `v201902-py2` + +This shows the implementation of the `v201902-py2` InSpec [profile](https://github.com/inspec/inspec/blob/master/docs/profiles.md). + +## Verify a profile + +InSpec ships with built-in features to verify a profile structure. + +```bash +$ inspec check v201902-py2 +Summary +------- +Location: v201902-py2 +Profile: profile +Controls: 4 +Timestamp: 2019-06-24T23:09:01+00:00 +Valid: true + +Errors +------ + +Warnings +-------- +``` + +## Execute a profile + +To run all **supported** controls on a local machine use `inspec exec /path/to/profile`. + +```bash +$ inspec exec v201902-py2 +.. + +Finished in 0.0025 seconds (files took 0.12449 seconds to load) +8 examples, 0 failures +``` + +## Execute a specific control from a profile + +To run one control from the profile use `inspec exec /path/to/profile --controls name`. + +```bash +$ inspec exec v201902-py2 --controls package +. + +Finished in 0.0025 seconds (files took 0.12449 seconds to load) +1 examples, 0 failures +``` + +See an [example control here](https://github.com/inspec/inspec/blob/master/examples/profile/controls/example.rb). diff --git a/test/integration/2018-3/pkgs_spec.rb b/test/integration/v201902-py2/controls/pkgs_spec.rb similarity index 54% rename from test/integration/2018-3/pkgs_spec.rb rename to test/integration/v201902-py2/controls/pkgs_spec.rb index 5a2efeb..1cd7d62 100644 --- a/test/integration/2018-3/pkgs_spec.rb +++ b/test/integration/v201902-py2/controls/pkgs_spec.rb @@ -1,11 +1,14 @@ -case os[:name] -when 'centos' - version = '2018.3.4-1.el7' -when 'debian', 'ubuntu' - version = '2018.3.4+ds-1' -when 'fedora' - version = '2018.3.2-5.fc29' -end +version = + case platform[:family] + when 'redhat' + '2019.2.0-1.el7' + when 'fedora' + '2019.2.0-1.fc30' + when 'suse' + '2019.2.0-lp151.5.3.1' + when 'debian' + '2019.2.0+ds-1' + end control 'salt packages' do title 'should be installed' diff --git a/test/integration/2019-2/service_spec.rb b/test/integration/v201902-py2/controls/service_spec.rb similarity index 100% rename from test/integration/2019-2/service_spec.rb rename to test/integration/v201902-py2/controls/service_spec.rb diff --git a/test/integration/v201902-py2/inspec.yml b/test/integration/v201902-py2/inspec.yml new file mode 100644 index 0000000..7a5266e --- /dev/null +++ b/test/integration/v201902-py2/inspec.yml @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +name: v201902-py2 +title: salt formula +maintainer: SaltStack Formulas +license: Apache-2.0 +summary: Verify that Salt `v201902-py2` is setup and configured +supports: + - platform-name: debian + - platform-name: ubuntu + - platform-name: centos + - platform-name: fedora + - platform-name: opensuse + - platform-name: suse + - platform-name: freebsd + - platform-name: amazon diff --git a/test/integration/v201902-py3/README.md b/test/integration/v201902-py3/README.md new file mode 100644 index 0000000..a44f865 --- /dev/null +++ b/test/integration/v201902-py3/README.md @@ -0,0 +1,50 @@ +# InSpec Profile: `v201902-py3` + +This shows the implementation of the `v201902-py3` InSpec [profile](https://github.com/inspec/inspec/blob/master/docs/profiles.md). + +## Verify a profile + +InSpec ships with built-in features to verify a profile structure. + +```bash +$ inspec check v201902-py3 +Summary +------- +Location: v201902-py3 +Profile: profile +Controls: 4 +Timestamp: 2019-06-24T23:09:01+00:00 +Valid: true + +Errors +------ + +Warnings +-------- +``` + +## Execute a profile + +To run all **supported** controls on a local machine use `inspec exec /path/to/profile`. + +```bash +$ inspec exec v201902-py3 +.. + +Finished in 0.0025 seconds (files took 0.12449 seconds to load) +8 examples, 0 failures +``` + +## Execute a specific control from a profile + +To run one control from the profile use `inspec exec /path/to/profile --controls name`. + +```bash +$ inspec exec v201902-py3 --controls package +. + +Finished in 0.0025 seconds (files took 0.12449 seconds to load) +1 examples, 0 failures +``` + +See an [example control here](https://github.com/inspec/inspec/blob/master/examples/profile/controls/example.rb). diff --git a/test/integration/v201902-py3/controls/pkgs_spec.rb b/test/integration/v201902-py3/controls/pkgs_spec.rb new file mode 100644 index 0000000..7a9e46a --- /dev/null +++ b/test/integration/v201902-py3/controls/pkgs_spec.rb @@ -0,0 +1,30 @@ +version = + case platform[:family] + when 'redhat' + case platform[:name] + when 'amazon' + '2019.2.0-1.el7' + when 'centos' + '2019.2.0-2.el7' + end + when 'fedora' + '2019.2.0-1.fc30' + when 'suse' + '2019.2.0-lp151.5.3.1' + when 'debian' + '2019.2.0+ds-1' + end + +control 'salt packages' do + title 'should be installed' + + %w( + salt-master + salt-minion + ).each do |p| + describe package(p) do + it { should be_installed } + its('version') { should eq version } + end + end +end diff --git a/test/integration/develop/service_spec.rb b/test/integration/v201902-py3/controls/service_spec.rb similarity index 100% rename from test/integration/develop/service_spec.rb rename to test/integration/v201902-py3/controls/service_spec.rb diff --git a/test/integration/v201902-py3/inspec.yml b/test/integration/v201902-py3/inspec.yml new file mode 100644 index 0000000..5e8eb7b --- /dev/null +++ b/test/integration/v201902-py3/inspec.yml @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +name: v201902-py3 +title: salt formula +maintainer: SaltStack Formulas +license: Apache-2.0 +summary: Verify that Salt `v201902-py3` is setup and configured +supports: + - platform-name: debian + - platform-name: ubuntu + - platform-name: centos + - platform-name: fedora + - platform-name: opensuse + - platform-name: suse + - platform-name: freebsd + - platform-name: amazon diff --git a/test/salt/pillar/develop-py3.sls b/test/salt/pillar/develop-py3.sls deleted file mode 100644 index 87999d3..0000000 --- a/test/salt/pillar/develop-py3.sls +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=yaml ---- -salt: - release: 'latest' - py_ver: 'py3' diff --git a/test/salt/pillar/v2017-7-py2.sls b/test/salt/pillar/v201707-py2.sls similarity index 100% rename from test/salt/pillar/v2017-7-py2.sls rename to test/salt/pillar/v201707-py2.sls diff --git a/test/salt/pillar/v2018-3-py2-forced-version.sls b/test/salt/pillar/v2018-3-py2-forced-version.sls deleted file mode 100644 index 3f4e5d8..0000000 --- a/test/salt/pillar/v2018-3-py2-forced-version.sls +++ /dev/null @@ -1,7 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=yaml ---- -salt: - release: '2018.3' - py_ver: 'py2' - version: '2018.3.2-5.fc29' diff --git a/test/salt/pillar/v2018-3-py2.sls b/test/salt/pillar/v201803-py2.sls similarity index 100% rename from test/salt/pillar/v2018-3-py2.sls rename to test/salt/pillar/v201803-py2.sls diff --git a/test/salt/pillar/v2019-2-py2.sls b/test/salt/pillar/v201902-py2.sls similarity index 100% rename from test/salt/pillar/v2019-2-py2.sls rename to test/salt/pillar/v201902-py2.sls diff --git a/test/salt/pillar/v2019-2-py3.sls b/test/salt/pillar/v201902-py3.sls similarity index 100% rename from test/salt/pillar/v2019-2-py3.sls rename to test/salt/pillar/v201902-py3.sls