Skip to content

Commit

Permalink
Merge pull request #213 from myii/feat/add-gentoo
Browse files Browse the repository at this point in the history
feat: add Gentoo support
  • Loading branch information
myii authored Oct 12, 2020
2 parents e78aa0c + 4c2f4ed commit 3c7558a
Show file tree
Hide file tree
Showing 9 changed files with 155 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ jobs:
# - env: INSTANCE=default-fedora-31-master-py3
- env: INSTANCE=default-opensuse-leap-152-master-py3
# - env: INSTANCE=default-amazonlinux-2-master-py3
- env: INSTANCE=gentoo-gentoo-stage3-latest-master-py3
- env: INSTANCE=gentoo-gentoo-stage3-systemd-master-py3
# - env: INSTANCE=default-debian-10-3001-py3
# - env: INSTANCE=default-debian-9-3001-py3
# - env: INSTANCE=default-ubuntu-2004-3001-py3
Expand All @@ -113,6 +115,8 @@ jobs:
# - env: INSTANCE=default-amazonlinux-2-3001-py3
# - env: INSTANCE=default-oraclelinux-8-3001-py3
# - env: INSTANCE=default-oraclelinux-7-3001-py3
# - env: INSTANCE=gentoo-gentoo-stage3-latest-3001-py3
# - env: INSTANCE=gentoo-gentoo-stage3-systemd-3001-py3
# - env: INSTANCE=default-debian-10-3000-3-py3
# - env: INSTANCE=default-debian-9-3000-3-py3
# - env: INSTANCE=default-ubuntu-1804-3000-3-py3
Expand All @@ -121,6 +125,8 @@ jobs:
# - env: INSTANCE=default-fedora-31-3000-3-py3
# - env: INSTANCE=default-opensuse-leap-152-3000-3-py3
# - env: INSTANCE=default-amazonlinux-2-3000-3-py3
# - env: INSTANCE=gentoo-gentoo-stage3-latest-3000-3-py3
# - env: INSTANCE=gentoo-gentoo-stage3-systemd-3000-3-py3
# - env: INSTANCE=default-ubuntu-1804-3000-3-py2
# - env: INSTANCE=default-ubuntu-1604-3000-3-py2
- env: INSTANCE=default-arch-base-latest-3000-3-py2
Expand Down
4 changes: 3 additions & 1 deletion TEMPLATE/osfamilymap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ Suse:
pkg:
name: TEMPLATE-suse

Gentoo: {}
Gentoo:
pkg:
name: TEMPLATE-gentoo

Arch:
pkg:
Expand Down
55 changes: 55 additions & 0 deletions kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ platforms:
- name: amazonlinux-2-master-py3
driver:
image: saltimages/salt-master-py3:amazonlinux-2
- name: gentoo-stage3-latest-master-py3
driver:
image: saltimages/salt-master-py3:gentoo-stage3-latest
run_command: /sbin/init
- name: gentoo-stage3-systemd-master-py3
driver:
image: saltimages/salt-master-py3:gentoo-stage3-systemd

## SALT `3001`
- name: debian-10-3001-py3
Expand Down Expand Up @@ -116,6 +123,13 @@ platforms:
- name: oraclelinux-7-3001-py3
driver:
image: saltimages/salt-3001-py3:oraclelinux-7
- name: gentoo-stage3-latest-3001-py3
driver:
image: saltimages/salt-3001-py3:gentoo-stage3-latest
run_command: /sbin/init
- name: gentoo-stage3-systemd-3001-py3
driver:
image: saltimages/salt-3001-py3:gentoo-stage3-systemd

## SALT `3000.3`
- name: debian-10-3000-3-py3
Expand Down Expand Up @@ -147,6 +161,13 @@ platforms:
- name: amazonlinux-2-3000-3-py3
driver:
image: saltimages/salt-3000.3-py3:amazonlinux-2
- name: gentoo-stage3-latest-3000-3-py3
driver:
image: saltimages/salt-3000.3-py3:gentoo-stage3-latest
run_command: /sbin/init
- name: gentoo-stage3-systemd-3000-3-py3
driver:
image: saltimages/salt-3000.3-py3:gentoo-stage3-systemd
- name: ubuntu-1804-3000-3-py2
driver:
image: saltimages/salt-3000.3-py2:ubuntu-18.04
Expand Down Expand Up @@ -191,6 +212,12 @@ suites:
excludes:
- centos-6-2019-2-py2
- amazonlinux-1-2019-2-py2
- gentoo-stage3-latest-master-py3
- gentoo-stage3-systemd-master-py3
- gentoo-stage3-latest-3001-py3
- gentoo-stage3-systemd-3001-py3
- gentoo-stage3-latest-3000-3-py3
- gentoo-stage3-systemd-3000-3-py3
provisioner:
state_top:
base:
Expand Down Expand Up @@ -231,3 +258,31 @@ suites:
verifier:
inspec_tests:
- path: test/integration/default
- name: gentoo
includes:
- gentoo-stage3-latest-master-py3
- gentoo-stage3-systemd-master-py3
- gentoo-stage3-latest-3001-py3
- gentoo-stage3-systemd-3001-py3
- gentoo-stage3-latest-3000-3-py3
- gentoo-stage3-systemd-3000-3-py3
provisioner:
state_top:
base:
'*':
- TEMPLATE._mapdata
- TEMPLATE
pillars:
top.sls:
base:
'*':
- TEMPLATE
- gentoo
- define_roles
pillars_from_files:
TEMPLATE.sls: pillar.example
gentoo.sls: test/salt/pillar/gentoo.sls
define_roles.sls: test/salt/pillar/define_roles.sls
verifier:
inspec_tests:
- path: test/integration/default
34 changes: 34 additions & 0 deletions test/integration/default/files/_mapdata/gentoo-2-sysd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# yamllint disable rule:indentation rule:line-length
# Gentoo-2
---
added_in_defaults: defaults_value
added_in_lookup: lookup_value
added_in_pillar: pillar_value
arch: amd64
config: /etc/template-formula.conf
lookup:
added_in_lookup: lookup_value
master: template-master
winner: lookup
master: template-master
pkg:
name: app-shells/bash
rootgroup: root
service:
name: systemd-journald
subcomponent:
config: /etc/TEMPLATE-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
- id
- roles
- osfinger
- os
- os_family
source_files:
TEMPLATE-config-file-file-managed:
- example.tmpl.jinja
TEMPLATE-subcomponent-config-file-file-managed:
- subcomponent-example.tmpl.jinja
winner: pillar
34 changes: 34 additions & 0 deletions test/integration/default/files/_mapdata/gentoo-2-sysv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# yamllint disable rule:indentation rule:line-length
# Gentoo-2
---
added_in_defaults: defaults_value
added_in_lookup: lookup_value
added_in_pillar: pillar_value
arch: amd64
config: /etc/template-formula.conf
lookup:
added_in_lookup: lookup_value
master: template-master
winner: lookup
master: template-master
pkg:
name: app-shells/bash
rootgroup: root
service:
name: mtab
subcomponent:
config: /etc/TEMPLATE-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
- id
- roles
- osfinger
- os
- os_family
source_files:
TEMPLATE-config-file-file-managed:
- example.tmpl.jinja
TEMPLATE-subcomponent-config-file-file-managed:
- subcomponent-example.tmpl.jinja
winner: pillar
1 change: 1 addition & 0 deletions test/integration/default/inspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ supports:
- platform-name: amazon
- platform-name: oracle
- platform-name: arch
- platform-name: gentoo
1 change: 1 addition & 0 deletions test/integration/share/inspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ supports:
- platform-name: amazon
- platform-name: oracle
- platform-name: arch
- platform-name: gentoo
11 changes: 11 additions & 0 deletions test/integration/share/libraries/system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,22 @@ def build_platform_release
inspec.platform[:release].gsub(/2018.*/, '1')
when 'arch'
'base-latest'
when 'gentoo'
"#{inspec.platform[:release].split('.')[0]}-#{derive_gentoo_init_system}"
else
inspec.platform[:release]
end
end

def derive_gentoo_init_system
case inspec.command('systemctl').exist?
when true
'sysd'
else
'sysv'
end
end

def build_platform_finger
"#{build_platform_name}-#{build_finger_release}"
end
Expand Down
10 changes: 10 additions & 0 deletions test/salt/pillar/gentoo.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
portage:
sync_wait_one_day: true
TEMPLATE:
pkg:
name: 'app-shells/bash'
service:
name: "{{ 'systemd-journald' if grains.init == 'systemd' else 'mtab' }}"

0 comments on commit 3c7558a

Please sign in to comment.