mirror of
https://github.com/saltstack-formulas/packages-formula.git
synced 2025-04-17 10:10:27 +00:00
feat(centos-8): added RedHat,CentOS and Oracle linux 8 support
Add centos 8 to osfingermap add oracle linux 8 to osfingermap moved RedHat/CentOS to osmap and osfingermap to accomodate changes in package provider versionlock enable centos-centos-8-master-py3 remove hardcoded packages yum-plugin-versionlock was hardcoded for all redhat versions, which is removed with centos 8. the package alien has a depency on debhelper which is broken in Centos-8 add share folder testing Co-authored-by: Imran Iqbal <myii@users.noreply.github.com>
This commit is contained in:
parent
f893e2af43
commit
75526cce61
14 changed files with 261 additions and 13 deletions
|
@ -126,7 +126,8 @@ rubocop:
|
||||||
debian-debian-10-master-py3: {extends: '.test_instance'}
|
debian-debian-10-master-py3: {extends: '.test_instance'}
|
||||||
# ubuntu-ubuntu-2004-master-py3: {extends: '.test_instance'}
|
# ubuntu-ubuntu-2004-master-py3: {extends: '.test_instance'}
|
||||||
ubuntu-ubuntu-1804-master-py3: {extends: '.test_instance'}
|
ubuntu-ubuntu-1804-master-py3: {extends: '.test_instance'}
|
||||||
# centos-centos-8-master-py3: {extends: '.test_instance'}
|
redhat8-centos-8-master-py3: {extends: '.test_instance'}
|
||||||
|
redhat8-oraclelinux-8-master-py3: {extends: '.test_instance'}
|
||||||
fedora-fedora-32-master-py3: {extends: '.test_instance'}
|
fedora-fedora-32-master-py3: {extends: '.test_instance'}
|
||||||
# fedora-fedora-31-master-py3: {extends: '.test_instance'}
|
# fedora-fedora-31-master-py3: {extends: '.test_instance'}
|
||||||
# suse-opensuse-leap-152-master-py3: {extends: '.test_instance'}
|
# suse-opensuse-leap-152-master-py3: {extends: '.test_instance'}
|
||||||
|
|
28
kitchen.yml
28
kitchen.yml
|
@ -44,6 +44,9 @@ platforms:
|
||||||
- name: amazonlinux-2-master-py3
|
- name: amazonlinux-2-master-py3
|
||||||
driver:
|
driver:
|
||||||
image: saltimages/salt-master-py3:amazonlinux-2
|
image: saltimages/salt-master-py3:amazonlinux-2
|
||||||
|
- name: oraclelinux-8-master-py3
|
||||||
|
driver:
|
||||||
|
image: saltimages/salt-master-py3:oraclelinux-8
|
||||||
|
|
||||||
## SALT `3000.3`
|
## SALT `3000.3`
|
||||||
- name: debian-10-3000-3-py3
|
- name: debian-10-3000-3-py3
|
||||||
|
@ -240,10 +243,33 @@ suites:
|
||||||
verifier:
|
verifier:
|
||||||
inspec_tests:
|
inspec_tests:
|
||||||
- path: test/integration/default
|
- path: test/integration/default
|
||||||
- name: centos
|
- name: redhat8
|
||||||
includes:
|
includes:
|
||||||
- centos-8-master-py3
|
- centos-8-master-py3
|
||||||
- centos-8-3000-3-py3
|
- centos-8-3000-3-py3
|
||||||
|
- oraclelinux-8-master-py3
|
||||||
|
provisioner:
|
||||||
|
state_top:
|
||||||
|
base:
|
||||||
|
'*':
|
||||||
|
- epel
|
||||||
|
- packages
|
||||||
|
pillars:
|
||||||
|
top.sls:
|
||||||
|
base:
|
||||||
|
'*':
|
||||||
|
- packages
|
||||||
|
pillars_from_files:
|
||||||
|
packages.sls: test/salt/pillar/redhat8.sls
|
||||||
|
dependencies:
|
||||||
|
- name: epel
|
||||||
|
repo: git
|
||||||
|
source: https://github.com/saltstack-formulas/epel-formula.git
|
||||||
|
verifier:
|
||||||
|
inspec_tests:
|
||||||
|
- path: test/integration/default
|
||||||
|
- name: centos
|
||||||
|
includes:
|
||||||
- centos-7-3000-3-py3
|
- centos-7-3000-3-py3
|
||||||
- centos-8-2019-2-py3
|
- centos-8-2019-2-py3
|
||||||
- centos-7-2019-2-py3
|
- centos-7-2019-2-py3
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
{%- import_yaml 'packages/defaults.yaml' as defaults %}
|
{%- import_yaml 'packages/defaults.yaml' as defaults %}
|
||||||
{%- import_yaml 'packages/osfamilymap.yaml' as osfamilymap %}
|
{%- import_yaml 'packages/osfamilymap.yaml' as osfamilymap %}
|
||||||
{%- import_yaml 'packages/osmap.yaml' as osmap %}
|
{%- import_yaml 'packages/osmap.yaml' as osmap %}
|
||||||
|
{%- import_yaml 'packages/osfingermap.yaml' as osfingermap %}
|
||||||
|
|
||||||
{%- set packages = salt['grains.filter_by'](
|
{%- set packages = salt['grains.filter_by'](
|
||||||
defaults,
|
defaults,
|
||||||
|
@ -13,7 +14,11 @@
|
||||||
merge = salt['grains.filter_by'](
|
merge = salt['grains.filter_by'](
|
||||||
osmap,
|
osmap,
|
||||||
grain='os',
|
grain='os',
|
||||||
merge = salt['config.get']('packages', {}),
|
merge = salt['grains.filter_by'](
|
||||||
|
osfingermap,
|
||||||
|
grain='osfinger',
|
||||||
|
merge = salt['config.get']('packages', {}),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
base='packages')
|
base='packages')
|
||||||
|
|
|
@ -21,10 +21,6 @@ Debian:
|
||||||
pkgs:
|
pkgs:
|
||||||
- ruby
|
- ruby
|
||||||
RedHat:
|
RedHat:
|
||||||
pkgs:
|
|
||||||
required:
|
|
||||||
pkgs:
|
|
||||||
- yum-plugin-versionlock
|
|
||||||
pips:
|
pips:
|
||||||
required:
|
required:
|
||||||
pkgs:
|
pkgs:
|
||||||
|
|
32
packages/osfingermap.yaml
Normal file
32
packages/osfingermap.yaml
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: ft=yaml
|
||||||
|
---
|
||||||
|
CentOS-6:
|
||||||
|
pkgs:
|
||||||
|
required:
|
||||||
|
pkgs:
|
||||||
|
- yum-plugin-versionlock
|
||||||
|
|
||||||
|
CentOS Linux-7:
|
||||||
|
pkgs:
|
||||||
|
required:
|
||||||
|
pkgs:
|
||||||
|
- yum-plugin-versionlock
|
||||||
|
|
||||||
|
CentOS Linux-8:
|
||||||
|
pkgs:
|
||||||
|
required:
|
||||||
|
pkgs:
|
||||||
|
- python3-dnf-plugin-versionlock
|
||||||
|
snaps:
|
||||||
|
collides: ['snap']
|
||||||
|
symlink: true
|
||||||
|
|
||||||
|
Oracle Linux Server-8:
|
||||||
|
pkgs:
|
||||||
|
required:
|
||||||
|
pkgs:
|
||||||
|
- python3-dnf-plugin-versionlock
|
||||||
|
snaps:
|
||||||
|
collides: ['snap']
|
||||||
|
symlink: true
|
|
@ -1,6 +1,12 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=yaml
|
# vim: ft=yaml
|
||||||
---
|
---
|
||||||
|
RedHat:
|
||||||
|
pkgs:
|
||||||
|
required:
|
||||||
|
pkgs:
|
||||||
|
- yum-plugin-versionlock
|
||||||
|
|
||||||
Fedora:
|
Fedora:
|
||||||
pkgs:
|
pkgs:
|
||||||
required:
|
required:
|
||||||
|
|
|
@ -9,7 +9,7 @@ control 'Wanted/Required gems' do
|
||||||
minitest
|
minitest
|
||||||
]
|
]
|
||||||
case platform[:name]
|
case platform[:name]
|
||||||
when 'centos', 'amazon'
|
when 'centos', 'amazon', 'oracle'
|
||||||
wanted.delete('minitest')
|
wanted.delete('minitest')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# Prepare platform "finger"
|
||||||
|
platform_finger = system.platform[:finger].split('.').first.to_s
|
||||||
|
|
||||||
## Some vars
|
## Some vars
|
||||||
common_packages = %w[
|
common_packages = %w[
|
||||||
git
|
git
|
||||||
|
@ -12,16 +15,15 @@ common_packages = %w[
|
||||||
case platform[:family]
|
case platform[:family]
|
||||||
when 'redhat'
|
when 'redhat'
|
||||||
platform_packages =
|
platform_packages =
|
||||||
case platform[:name]
|
case platform_finger
|
||||||
when 'amazon'
|
when 'centos-8', 'oraclelinux-8'
|
||||||
%w[git]
|
%w[python3-dnf-plugin-versionlock]
|
||||||
else
|
else
|
||||||
%w[yum-plugin-versionlock]
|
%w[yum-plugin-versionlock]
|
||||||
end
|
end
|
||||||
held_packages = {
|
held_packages = {
|
||||||
# We use this test for held packages in a list,
|
# We use this test for held packages in a list,
|
||||||
# with no version (current version).
|
# with no version (current version).
|
||||||
'alien': '',
|
|
||||||
'iotop': ''
|
'iotop': ''
|
||||||
}
|
}
|
||||||
lock_file = '/etc/yum/pluginconf.d/versionlock.list'
|
lock_file = '/etc/yum/pluginconf.d/versionlock.list'
|
||||||
|
|
|
@ -6,6 +6,9 @@ title: packages formula
|
||||||
maintainer: SaltStack Formulas
|
maintainer: SaltStack Formulas
|
||||||
license: Apache-2.0
|
license: Apache-2.0
|
||||||
summary: Verify that the packages formula is setup and configured correctly
|
summary: Verify that the packages formula is setup and configured correctly
|
||||||
|
depends:
|
||||||
|
- name: share
|
||||||
|
path: test/integration/share
|
||||||
supports:
|
supports:
|
||||||
- platform-name: debian
|
- platform-name: debian
|
||||||
- platform-name: ubuntu
|
- platform-name: ubuntu
|
||||||
|
@ -15,4 +18,5 @@ supports:
|
||||||
- platform-name: suse
|
- platform-name: suse
|
||||||
- platform-name: freebsd
|
- platform-name: freebsd
|
||||||
- platform-name: amazon
|
- platform-name: amazon
|
||||||
|
- platform-name: oracle
|
||||||
- platform-name: arch
|
- platform-name: arch
|
||||||
|
|
22
test/integration/share/README.md
Normal file
22
test/integration/share/README.md
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
# InSpec Profile: `share`
|
||||||
|
|
||||||
|
This shows the implementation of the `share` InSpec [profile](https://github.com/inspec/inspec/blob/master/docs/profiles.md).
|
||||||
|
|
||||||
|
Its goal is to share the libraries between all profiles.
|
||||||
|
|
||||||
|
## Libraries
|
||||||
|
|
||||||
|
### `system`
|
||||||
|
|
||||||
|
The `system` library provides easy access to system dependent information:
|
||||||
|
|
||||||
|
- `system.platform`: based on `inspec.platform`, modify to values that are more consistent from a SaltStack perspective
|
||||||
|
- `system.platform[:family]` provide a family name for Arch and Gentoo
|
||||||
|
- `system.platform[:name]` append `linux` to both `amazon` and `oracle`; ensure Windows platforms are resolved as simply `windows`
|
||||||
|
- `system.platform[:release]` tweak Arch, Amazon Linux, Gentoo, openSUSE and Windows:
|
||||||
|
- `Arch` is always `base-latest`
|
||||||
|
- `Amazon Linux` release `2018` is resolved as `1`
|
||||||
|
- `Gentoo` release is trimmed to its major version number and then the init system is appended (i.e. `sysv` or `sysd`)
|
||||||
|
- `openSUSE` is resolved as `tumbleweed` if the `platform[:release]` is in date format
|
||||||
|
- `Windows` uses the widely-used release number (e.g. `8.1` or `2019-server`) in place of the actual system release version
|
||||||
|
- `system.platform[:finger]` is the concatenation of the name and the major release number (except for Ubuntu, which gives `ubuntu-20.04` for example)
|
21
test/integration/share/inspec.yml
Normal file
21
test/integration/share/inspec.yml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: ft=yaml
|
||||||
|
---
|
||||||
|
name: share
|
||||||
|
title: InSpec shared resources
|
||||||
|
maintainer: SaltStack Formulas
|
||||||
|
license: Apache-2.0
|
||||||
|
summary: shared resources
|
||||||
|
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
|
||||||
|
- platform-name: oracle
|
||||||
|
- platform-name: arch
|
||||||
|
- platform-name: gentoo
|
||||||
|
- platform: windows
|
88
test/integration/share/libraries/system.rb
Normal file
88
test/integration/share/libraries/system.rb
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# system.rb -- InSpec resources for system values
|
||||||
|
# Author: Daniel Dehennin <daniel.dehennin@ac-dijon.fr>
|
||||||
|
# Copyright (C) 2020 Daniel Dehennin <daniel.dehennin@ac-dijon.fr>
|
||||||
|
|
||||||
|
class SystemResource < Inspec.resource(1)
|
||||||
|
name 'system'
|
||||||
|
|
||||||
|
attr_reader :platform
|
||||||
|
|
||||||
|
def initialize
|
||||||
|
super
|
||||||
|
@platform = build_platform
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def build_platform
|
||||||
|
{
|
||||||
|
family: build_platform_family,
|
||||||
|
name: build_platform_name,
|
||||||
|
release: build_platform_release,
|
||||||
|
finger: build_platform_finger
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
def build_platform_family
|
||||||
|
case inspec.platform[:name]
|
||||||
|
when 'arch', 'gentoo'
|
||||||
|
inspec.platform[:name]
|
||||||
|
else
|
||||||
|
inspec.platform[:family]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def build_platform_name
|
||||||
|
case inspec.platform[:name]
|
||||||
|
when 'amazon', 'oracle'
|
||||||
|
"#{inspec.platform[:name]}linux"
|
||||||
|
when 'windows_8.1_pro', 'windows_server_2019_datacenter'
|
||||||
|
'windows'
|
||||||
|
else
|
||||||
|
inspec.platform[:name]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# rubocop:disable Metrics/MethodLength,Metrics/AbcSize,Metrics/CyclomaticComplexity
|
||||||
|
def build_platform_release
|
||||||
|
case inspec.platform[:name]
|
||||||
|
when 'amazon'
|
||||||
|
# `2018` relase is named `1` in kitchen.yaml
|
||||||
|
inspec.platform[:release].gsub(/2018.*/, '1')
|
||||||
|
when 'arch'
|
||||||
|
'base-latest'
|
||||||
|
when 'gentoo'
|
||||||
|
"#{inspec.platform[:release].split('.')[0]}-#{derive_gentoo_init_system}"
|
||||||
|
when 'opensuse'
|
||||||
|
# rubocop:disable Style/NumericLiterals,Layout/LineLength
|
||||||
|
inspec.platform[:release].to_i > 20210101 ? 'tumbleweed' : inspec.platform[:release]
|
||||||
|
# rubocop:enable Style/NumericLiterals,Layout/LineLength
|
||||||
|
when 'windows_8.1_pro'
|
||||||
|
'8.1'
|
||||||
|
when 'windows_server_2019_datacenter'
|
||||||
|
'2019-server'
|
||||||
|
else
|
||||||
|
inspec.platform[:release]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
# rubocop:enable Metrics/MethodLength,Metrics/AbcSize,Metrics/CyclomaticComplexity
|
||||||
|
|
||||||
|
def derive_gentoo_init_system
|
||||||
|
inspec.command('systemctl').exist? ? 'sysd' : 'sysv'
|
||||||
|
end
|
||||||
|
|
||||||
|
def build_platform_finger
|
||||||
|
"#{build_platform_name}-#{build_finger_release}"
|
||||||
|
end
|
||||||
|
|
||||||
|
def build_finger_release
|
||||||
|
case inspec.platform[:name]
|
||||||
|
when 'ubuntu'
|
||||||
|
build_platform_release.split('.').slice(0, 2).join('.')
|
||||||
|
else
|
||||||
|
build_platform_release.split('.')[0]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -4,7 +4,7 @@
|
||||||
packages:
|
packages:
|
||||||
pkgs:
|
pkgs:
|
||||||
held:
|
held:
|
||||||
- alien
|
# - alien
|
||||||
- iotop
|
- iotop
|
||||||
wanted:
|
wanted:
|
||||||
- git
|
- git
|
||||||
|
|
45
test/salt/pillar/redhat8.sls
Normal file
45
test/salt/pillar/redhat8.sls
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: ft=yaml
|
||||||
|
---
|
||||||
|
packages:
|
||||||
|
pkgs:
|
||||||
|
held:
|
||||||
|
# - alien
|
||||||
|
- iotop
|
||||||
|
wanted:
|
||||||
|
- git
|
||||||
|
- less
|
||||||
|
- bc
|
||||||
|
- curl
|
||||||
|
- fail2ban
|
||||||
|
unwanted:
|
||||||
|
- avahi-daemon
|
||||||
|
required:
|
||||||
|
pkgs:
|
||||||
|
- git
|
||||||
|
- python3-dnf-plugin-versionlock
|
||||||
|
pips:
|
||||||
|
wanted:
|
||||||
|
- attrs
|
||||||
|
unwanted:
|
||||||
|
- campbel
|
||||||
|
- reverse_geocode
|
||||||
|
- indy-crypto
|
||||||
|
gems:
|
||||||
|
wanted:
|
||||||
|
- progressbar
|
||||||
|
# minitest requires Ruby version ~> 2.2.
|
||||||
|
# ruby 2.0.0p648 (2015-12-16) [x86_64-linux]
|
||||||
|
# https://stackoverflow.com/a/50931910
|
||||||
|
# $ sudo amazon-linux-extras install ruby2.6
|
||||||
|
# - minitest
|
||||||
|
unwanted:
|
||||||
|
- diff-lcs
|
||||||
|
- kitchen-vagrant
|
||||||
|
- kwalify
|
||||||
|
remote_pkgs:
|
||||||
|
zoom: 'https://zoom.us/client/latest/zoom_x86_64.rpm'
|
||||||
|
|
||||||
|
# Override the default setting to prevent wasteful delays in Travis
|
||||||
|
retry_options:
|
||||||
|
attempts: 1
|
Loading…
Add table
Reference in a new issue