Merge pull request #1500 from ijansky/bootstrap-gentoo

Support git and stable salt-bootstrap on Gentoo.
This commit is contained in:
Pedro Algarvio 2020-09-30 05:38:33 +01:00 committed by GitHub
commit fd57a0a753
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 1119 additions and 79 deletions

View file

@ -3264,6 +3264,834 @@ jobs:
bundle exec kitchen destroy latest-fedora-32
py3-stable-2019-2-gentoo:
name: Gentoo v2019.2 Py3 Stable
runs-on: ubuntu-latest
timeout-minutes: 45
needs: lint
steps:
- uses: actions/checkout@v1
- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Install Bundler
run: |
gem install bundler
- name: Setup Bundle
run: |
bundle install --with docker --without opennebula ec2 windows vagrant
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install Python Dependencies
run: |
pip install -U pip
pip install -r tests/requirements.txt
- name: Create Test Container
run: |
bundle exec kitchen create py3-stable-2019-2-gentoo || bundle exec kitchen create py3-stable-2019-2-gentoo
- name: Test Bootstrap In Test Container
run: |
bundle exec kitchen verify py3-stable-2019-2-gentoo
- name: Destroy Test Container
if: always()
run: |
bundle exec kitchen destroy py3-stable-2019-2-gentoo
py3-git-2019-2-gentoo:
name: Gentoo v2019.2 Py3 Git
runs-on: ubuntu-latest
timeout-minutes: 45
needs: lint
steps:
- uses: actions/checkout@v1
- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Install Bundler
run: |
gem install bundler
- name: Setup Bundle
run: |
bundle install --with docker --without opennebula ec2 windows vagrant
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install Python Dependencies
run: |
pip install -U pip
pip install -r tests/requirements.txt
- name: Create Test Container
run: |
bundle exec kitchen create py3-git-2019-2-gentoo || bundle exec kitchen create py3-git-2019-2-gentoo
- name: Test Bootstrap In Test Container
run: |
bundle exec kitchen verify py3-git-2019-2-gentoo
- name: Destroy Test Container
if: always()
run: |
bundle exec kitchen destroy py3-git-2019-2-gentoo
py3-stable-3000-gentoo:
name: Gentoo v3000 Py3 Stable
runs-on: ubuntu-latest
timeout-minutes: 45
needs: lint
steps:
- uses: actions/checkout@v1
- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Install Bundler
run: |
gem install bundler
- name: Setup Bundle
run: |
bundle install --with docker --without opennebula ec2 windows vagrant
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install Python Dependencies
run: |
pip install -U pip
pip install -r tests/requirements.txt
- name: Create Test Container
run: |
bundle exec kitchen create py3-stable-3000-gentoo || bundle exec kitchen create py3-stable-3000-gentoo
- name: Test Bootstrap In Test Container
run: |
bundle exec kitchen verify py3-stable-3000-gentoo
- name: Destroy Test Container
if: always()
run: |
bundle exec kitchen destroy py3-stable-3000-gentoo
py3-git-3000-gentoo:
name: Gentoo v3000 Py3 Git
runs-on: ubuntu-latest
timeout-minutes: 45
needs: lint
steps:
- uses: actions/checkout@v1
- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Install Bundler
run: |
gem install bundler
- name: Setup Bundle
run: |
bundle install --with docker --without opennebula ec2 windows vagrant
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install Python Dependencies
run: |
pip install -U pip
pip install -r tests/requirements.txt
- name: Create Test Container
run: |
bundle exec kitchen create py3-git-3000-gentoo || bundle exec kitchen create py3-git-3000-gentoo
- name: Test Bootstrap In Test Container
run: |
bundle exec kitchen verify py3-git-3000-gentoo
- name: Destroy Test Container
if: always()
run: |
bundle exec kitchen destroy py3-git-3000-gentoo
py3-stable-3001-gentoo:
name: Gentoo v3001 Py3 Stable
runs-on: ubuntu-latest
timeout-minutes: 45
needs: lint
steps:
- uses: actions/checkout@v1
- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Install Bundler
run: |
gem install bundler
- name: Setup Bundle
run: |
bundle install --with docker --without opennebula ec2 windows vagrant
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install Python Dependencies
run: |
pip install -U pip
pip install -r tests/requirements.txt
- name: Create Test Container
run: |
bundle exec kitchen create py3-stable-3001-gentoo || bundle exec kitchen create py3-stable-3001-gentoo
- name: Test Bootstrap In Test Container
run: |
bundle exec kitchen verify py3-stable-3001-gentoo
- name: Destroy Test Container
if: always()
run: |
bundle exec kitchen destroy py3-stable-3001-gentoo
py3-git-3001-gentoo:
name: Gentoo v3001 Py3 Git
runs-on: ubuntu-latest
timeout-minutes: 45
needs: lint
steps:
- uses: actions/checkout@v1
- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Install Bundler
run: |
gem install bundler
- name: Setup Bundle
run: |
bundle install --with docker --without opennebula ec2 windows vagrant
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install Python Dependencies
run: |
pip install -U pip
pip install -r tests/requirements.txt
- name: Create Test Container
run: |
bundle exec kitchen create py3-git-3001-gentoo || bundle exec kitchen create py3-git-3001-gentoo
- name: Test Bootstrap In Test Container
run: |
bundle exec kitchen verify py3-git-3001-gentoo
- name: Destroy Test Container
if: always()
run: |
bundle exec kitchen destroy py3-git-3001-gentoo
py3-stable-3001-0-gentoo:
name: Gentoo v3001.0 Py3 Stable
runs-on: ubuntu-latest
timeout-minutes: 45
needs: lint
steps:
- uses: actions/checkout@v1
- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Install Bundler
run: |
gem install bundler
- name: Setup Bundle
run: |
bundle install --with docker --without opennebula ec2 windows vagrant
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install Python Dependencies
run: |
pip install -U pip
pip install -r tests/requirements.txt
- name: Create Test Container
run: |
bundle exec kitchen create py3-stable-3001-0-gentoo || bundle exec kitchen create py3-stable-3001-0-gentoo
- name: Test Bootstrap In Test Container
run: |
bundle exec kitchen verify py3-stable-3001-0-gentoo
- name: Destroy Test Container
if: always()
run: |
bundle exec kitchen destroy py3-stable-3001-0-gentoo
py3-git-master-gentoo:
name: Gentoo Master Py3 Git
runs-on: ubuntu-latest
timeout-minutes: 45
needs: lint
steps:
- uses: actions/checkout@v1
- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Install Bundler
run: |
gem install bundler
- name: Setup Bundle
run: |
bundle install --with docker --without opennebula ec2 windows vagrant
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install Python Dependencies
run: |
pip install -U pip
pip install -r tests/requirements.txt
- name: Create Test Container
run: |
bundle exec kitchen create py3-git-master-gentoo || bundle exec kitchen create py3-git-master-gentoo
- name: Test Bootstrap In Test Container
run: |
bundle exec kitchen verify py3-git-master-gentoo
- name: Destroy Test Container
if: always()
run: |
bundle exec kitchen destroy py3-git-master-gentoo
latest-gentoo:
name: Gentoo Latest packaged release
runs-on: ubuntu-latest
timeout-minutes: 45
needs: lint
steps:
- uses: actions/checkout@v1
- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Install Bundler
run: |
gem install bundler
- name: Setup Bundle
run: |
bundle install --with docker --without opennebula ec2 windows vagrant
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install Python Dependencies
run: |
pip install -U pip
pip install -r tests/requirements.txt
- name: Create Test Container
run: |
bundle exec kitchen create latest-gentoo || bundle exec kitchen create latest-gentoo
- name: Test Bootstrap In Test Container
run: |
bundle exec kitchen verify latest-gentoo
- name: Destroy Test Container
if: always()
run: |
bundle exec kitchen destroy latest-gentoo
py3-stable-2019-2-gentoo-systemd:
name: Gentoo (systemd) v2019.2 Py3 Stable
runs-on: ubuntu-latest
timeout-minutes: 45
needs: lint
steps:
- uses: actions/checkout@v1
- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Install Bundler
run: |
gem install bundler
- name: Setup Bundle
run: |
bundle install --with docker --without opennebula ec2 windows vagrant
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install Python Dependencies
run: |
pip install -U pip
pip install -r tests/requirements.txt
- name: Create Test Container
run: |
bundle exec kitchen create py3-stable-2019-2-gentoo-systemd || bundle exec kitchen create py3-stable-2019-2-gentoo-systemd
- name: Test Bootstrap In Test Container
run: |
bundle exec kitchen verify py3-stable-2019-2-gentoo-systemd
- name: Destroy Test Container
if: always()
run: |
bundle exec kitchen destroy py3-stable-2019-2-gentoo-systemd
py3-git-2019-2-gentoo-systemd:
name: Gentoo (systemd) v2019.2 Py3 Git
runs-on: ubuntu-latest
timeout-minutes: 45
needs: lint
steps:
- uses: actions/checkout@v1
- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Install Bundler
run: |
gem install bundler
- name: Setup Bundle
run: |
bundle install --with docker --without opennebula ec2 windows vagrant
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install Python Dependencies
run: |
pip install -U pip
pip install -r tests/requirements.txt
- name: Create Test Container
run: |
bundle exec kitchen create py3-git-2019-2-gentoo-systemd || bundle exec kitchen create py3-git-2019-2-gentoo-systemd
- name: Test Bootstrap In Test Container
run: |
bundle exec kitchen verify py3-git-2019-2-gentoo-systemd
- name: Destroy Test Container
if: always()
run: |
bundle exec kitchen destroy py3-git-2019-2-gentoo-systemd
py3-stable-3000-gentoo-systemd:
name: Gentoo (systemd) v3000 Py3 Stable
runs-on: ubuntu-latest
timeout-minutes: 45
needs: lint
steps:
- uses: actions/checkout@v1
- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Install Bundler
run: |
gem install bundler
- name: Setup Bundle
run: |
bundle install --with docker --without opennebula ec2 windows vagrant
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install Python Dependencies
run: |
pip install -U pip
pip install -r tests/requirements.txt
- name: Create Test Container
run: |
bundle exec kitchen create py3-stable-3000-gentoo-systemd || bundle exec kitchen create py3-stable-3000-gentoo-systemd
- name: Test Bootstrap In Test Container
run: |
bundle exec kitchen verify py3-stable-3000-gentoo-systemd
- name: Destroy Test Container
if: always()
run: |
bundle exec kitchen destroy py3-stable-3000-gentoo-systemd
py3-git-3000-gentoo-systemd:
name: Gentoo (systemd) v3000 Py3 Git
runs-on: ubuntu-latest
timeout-minutes: 45
needs: lint
steps:
- uses: actions/checkout@v1
- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Install Bundler
run: |
gem install bundler
- name: Setup Bundle
run: |
bundle install --with docker --without opennebula ec2 windows vagrant
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install Python Dependencies
run: |
pip install -U pip
pip install -r tests/requirements.txt
- name: Create Test Container
run: |
bundle exec kitchen create py3-git-3000-gentoo-systemd || bundle exec kitchen create py3-git-3000-gentoo-systemd
- name: Test Bootstrap In Test Container
run: |
bundle exec kitchen verify py3-git-3000-gentoo-systemd
- name: Destroy Test Container
if: always()
run: |
bundle exec kitchen destroy py3-git-3000-gentoo-systemd
py3-stable-3001-gentoo-systemd:
name: Gentoo (systemd) v3001 Py3 Stable
runs-on: ubuntu-latest
timeout-minutes: 45
needs: lint
steps:
- uses: actions/checkout@v1
- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Install Bundler
run: |
gem install bundler
- name: Setup Bundle
run: |
bundle install --with docker --without opennebula ec2 windows vagrant
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install Python Dependencies
run: |
pip install -U pip
pip install -r tests/requirements.txt
- name: Create Test Container
run: |
bundle exec kitchen create py3-stable-3001-gentoo-systemd || bundle exec kitchen create py3-stable-3001-gentoo-systemd
- name: Test Bootstrap In Test Container
run: |
bundle exec kitchen verify py3-stable-3001-gentoo-systemd
- name: Destroy Test Container
if: always()
run: |
bundle exec kitchen destroy py3-stable-3001-gentoo-systemd
py3-git-3001-gentoo-systemd:
name: Gentoo (systemd) v3001 Py3 Git
runs-on: ubuntu-latest
timeout-minutes: 45
needs: lint
steps:
- uses: actions/checkout@v1
- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Install Bundler
run: |
gem install bundler
- name: Setup Bundle
run: |
bundle install --with docker --without opennebula ec2 windows vagrant
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install Python Dependencies
run: |
pip install -U pip
pip install -r tests/requirements.txt
- name: Create Test Container
run: |
bundle exec kitchen create py3-git-3001-gentoo-systemd || bundle exec kitchen create py3-git-3001-gentoo-systemd
- name: Test Bootstrap In Test Container
run: |
bundle exec kitchen verify py3-git-3001-gentoo-systemd
- name: Destroy Test Container
if: always()
run: |
bundle exec kitchen destroy py3-git-3001-gentoo-systemd
py3-stable-3001-0-gentoo-systemd:
name: Gentoo (systemd) v3001.0 Py3 Stable
runs-on: ubuntu-latest
timeout-minutes: 45
needs: lint
steps:
- uses: actions/checkout@v1
- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Install Bundler
run: |
gem install bundler
- name: Setup Bundle
run: |
bundle install --with docker --without opennebula ec2 windows vagrant
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install Python Dependencies
run: |
pip install -U pip
pip install -r tests/requirements.txt
- name: Create Test Container
run: |
bundle exec kitchen create py3-stable-3001-0-gentoo-systemd || bundle exec kitchen create py3-stable-3001-0-gentoo-systemd
- name: Test Bootstrap In Test Container
run: |
bundle exec kitchen verify py3-stable-3001-0-gentoo-systemd
- name: Destroy Test Container
if: always()
run: |
bundle exec kitchen destroy py3-stable-3001-0-gentoo-systemd
py3-git-master-gentoo-systemd:
name: Gentoo (systemd) Master Py3 Git
runs-on: ubuntu-latest
timeout-minutes: 45
needs: lint
steps:
- uses: actions/checkout@v1
- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Install Bundler
run: |
gem install bundler
- name: Setup Bundle
run: |
bundle install --with docker --without opennebula ec2 windows vagrant
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install Python Dependencies
run: |
pip install -U pip
pip install -r tests/requirements.txt
- name: Create Test Container
run: |
bundle exec kitchen create py3-git-master-gentoo-systemd || bundle exec kitchen create py3-git-master-gentoo-systemd
- name: Test Bootstrap In Test Container
run: |
bundle exec kitchen verify py3-git-master-gentoo-systemd
- name: Destroy Test Container
if: always()
run: |
bundle exec kitchen destroy py3-git-master-gentoo-systemd
latest-gentoo-systemd:
name: Gentoo (systemd) Latest packaged release
runs-on: ubuntu-latest
timeout-minutes: 45
needs: lint
steps:
- uses: actions/checkout@v1
- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Install Bundler
run: |
gem install bundler
- name: Setup Bundle
run: |
bundle install --with docker --without opennebula ec2 windows vagrant
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install Python Dependencies
run: |
pip install -U pip
pip install -r tests/requirements.txt
- name: Create Test Container
run: |
bundle exec kitchen create latest-gentoo-systemd || bundle exec kitchen create latest-gentoo-systemd
- name: Test Bootstrap In Test Container
run: |
bundle exec kitchen verify latest-gentoo-systemd
- name: Destroy Test Container
if: always()
run: |
bundle exec kitchen destroy latest-gentoo-systemd
py3-git-2019-2-opensuse-15:
name: Opensuse 15 v2019.2 Py3 Git
runs-on: ubuntu-latest

View file

@ -18,6 +18,8 @@ LINUX_DISTROS = [
'fedora-30',
'fedora-31',
'fedora-32',
'gentoo',
'gentoo-systemd',
'opensuse-15',
'ubuntu-1604',
'ubuntu-1804',
@ -37,6 +39,8 @@ STABLE_DISTROS = [
'fedora-30',
'fedora-31',
'fedora-32',
'gentoo',
'gentoo-systemd',
'ubuntu-1604',
'ubuntu-1804',
'ubuntu-2004',
@ -48,6 +52,8 @@ PY2_BLACKLIST = [
'fedora-30',
'fedora-31',
'fedora-32',
'gentoo',
'gentoo-systemd',
'opensuse-15',
'ubuntu-2004',
]
@ -110,17 +116,26 @@ DISTRO_DISPLAY_NAMES = {
'fedora-30': 'Fedora 30',
'fedora-31': 'Fedora 31',
'fedora-32': 'Fedora 32',
'gentoo': 'Gentoo',
'gentoo-systemd': 'Gentoo (systemd)',
'opensuse-15': 'Opensuse 15',
'ubuntu-1604': 'Ubuntu 16.04',
'ubuntu-1804': 'Ubuntu 18.04',
'ubuntu-2004': 'Ubuntu 20.04',
}
TIMEOUT_DEFAULT = 20
TIMEOUT_OVERRIDES = {
'gentoo': 45,
'gentoo-systemd': 45,
}
def generate_test_jobs():
test_jobs = ''
for distro in LINUX_DISTROS + OSX + WINDOWS:
timeout_minutes = TIMEOUT_OVERRIDES[distro] if distro in TIMEOUT_OVERRIDES else TIMEOUT_DEFAULT
for branch in SALT_BRANCHES:
if branch == 'master' and distro in SALT_POST_3000_BLACKLIST:
@ -153,7 +168,8 @@ def generate_test_jobs():
branch=branch,
display_name='{} Latest packaged release'.format(
DISTRO_DISPLAY_NAMES[distro],
)
),
timeout_minutes=timeout_minutes
)
)
continue
@ -236,7 +252,8 @@ def generate_test_jobs():
BRANCH_DISPLAY_NAMES[branch],
python_version.capitalize(),
bootstrap_type.capitalize()
)
),
timeout_minutes=timeout_minutes
)
)

View file

@ -1,7 +1,7 @@
{python_version}-{bootstrap_type}-{branch}-{distro}:
name: {display_name}
runs-on: ubuntu-latest
timeout-minutes: 20
timeout-minutes: {timeout_minutes}
needs: lint

View file

@ -93,6 +93,18 @@ platforms:
run_command: /usr/lib/systemd/systemd
provision_command:
- dnf -y install procps-ng
- name: gentoo
driver_config:
image: gentoo/stage3:latest
run_command: /sbin/init
provision_command:
- rc-update add sshd default
- name: gentoo-systemd
driver_config:
image: gentoo/stage3:systemd
run_command: /lib/systemd/systemd
provision_command:
- systemctl enable sshd.service
- name: opensuse-15
driver_config:
image: opensuse/leap:15.1
@ -117,12 +129,21 @@ suites:
- name: py2-git-2019-2
provisioner:
salt_version: 2019.2
excludes:
- gentoo
- gentoo-systemd
- name: py2-git-3000
provisioner:
salt_version: 3000
excludes:
- gentoo
- gentoo-systemd
- name: py2-git-master
provisioner:
salt_version: master
excludes:
- gentoo
- gentoo-systemd
- name: py2-stable-2019-2
provisioner:
salt_version: 2019.2
@ -133,6 +154,8 @@ suites:
- fedora-30
- fedora-31
- fedora-32
- gentoo
- gentoo-systemd
- ubuntu-2004
- name: py2-stable-3000
provisioner:
@ -144,6 +167,8 @@ suites:
- fedora-30
- fedora-31
- fedora-32
- gentoo
- gentoo-systemd
- ubuntu-2004
- name: py3-git-3000

View file

@ -2,4 +2,4 @@ source "https://rubygems.org"
gem 'test-kitchen', '>= 2.0.1'
gem 'kitchen-salt', '>= 0.5'
gem 'kitchen-docker', '>= 2.9.0'
gem 'kitchen-docker', github: 'test-kitchen/kitchen-docker'

View file

@ -1806,7 +1806,7 @@ elif [ "${DISTRO_NAME_L}" = "debian" ]; then
__debian_codename_translation
fi
if [ "$(echo "${DISTRO_NAME_L}" | grep -E '(debian|ubuntu|centos|red_hat|oracle|scientific|amazon|fedora|macosx)')" = "" ] && [ "$ITYPE" = "stable" ] && [ "$STABLE_REV" != "latest" ]; then
if [ "$(echo "${DISTRO_NAME_L}" | grep -E '(debian|ubuntu|centos|gentoo|red_hat|oracle|scientific|amazon|fedora|macosx)')" = "" ] && [ "$ITYPE" = "stable" ] && [ "$STABLE_REV" != "latest" ]; then
echoerror "${DISTRO_NAME} does not have major version pegged packages support"
exit 1
fi
@ -2512,11 +2512,11 @@ __check_services_openbsd() {
} # ---------- end of function __check_services_openbsd ----------
#--- FUNCTION -------------------------------------------------------------------------------------------------------
# NAME: __check_services_alpine
# NAME: __check_services_openrc
# DESCRIPTION: Return 0 or 1 in case the service is enabled or not
# PARAMETERS: servicename
#----------------------------------------------------------------------------------------------------------------------
__check_services_alpine() {
__check_services_openrc() {
if [ $# -eq 0 ]; then
echoerror "You need to pass a service name to check!"
exit 1
@ -2535,7 +2535,7 @@ __check_services_alpine() {
echodebug "Service ${servicename} is NOT enabled"
return 1
fi
} # ---------- end of function __check_services_openbsd ----------
} # ---------- end of function __check_services_openrc ----------
#--- FUNCTION -------------------------------------------------------------------------------------------------------
@ -5108,7 +5108,7 @@ install_alpine_linux_check_services() {
[ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
__check_services_alpine salt-$fname || return 1
__check_services_openrc salt-$fname || return 1
done
return 0
@ -7004,26 +7004,37 @@ install_suse_check_services() {
# Gentoo Install Functions.
#
__autounmask() {
emerge --autounmask-write --autounmask-only "${@}"; return $?
}
__emerge() {
if [ "$_GENTOO_USE_BINHOST" -eq $BS_TRUE ]; then
emerge --getbinpkg "${@}"; return $?
fi
emerge "${@}"; return $?
}
__gentoo_config_protection() {
# usually it's a good thing to have config files protected by portage, but
# Unmask package(s) and accept changes
#
# Usually it's a good thing to have config files protected by portage, but
# in this case this would require to interrupt the bootstrapping script at
# this point, manually merge the changes using etc-update/dispatch-conf/
# cfg-update and then restart the bootstrapping script, so instead we allow
# at this point to modify certain config files directly
export CONFIG_PROTECT_MASK="${CONFIG_PROTECT_MASK:-} /etc/portage/package.accept_keywords /etc/portage/package.keywords /etc/portage/package.license /etc/portage/package.unmask /etc/portage/package.use"
export CONFIG_PROTECT_MASK="${CONFIG_PROTECT_MASK:-}
/etc/portage/package.accept_keywords
/etc/portage/package.keywords
/etc/portage/package.license
/etc/portage/package.unmask
/etc/portage/package.use"
emerge --autounmask --autounmask-continue --autounmask-only --autounmask-write "${@}"; return $?
}
# emerge currently won't write to files that aren't there, so we need to ensure their presence
touch /etc/portage/package.accept_keywords /etc/portage/package.keywords /etc/portage/package.license /etc/portage/package.unmask /etc/portage/package.use
__emerge() {
EMERGE_FLAGS='-q'
if [ "$_ECHO_DEBUG" -eq $BS_TRUE ]; then
EMERGE_FLAGS='-v'
fi
# Do not re-emerge packages that are already installed
EMERGE_FLAGS="${EMERGE_FLAGS} --noreplace"
if [ "$_GENTOO_USE_BINHOST" -eq $BS_TRUE ]; then
EMERGE_FLAGS="${EMERGE_FLAGS} --getbinpkg"
fi
# shellcheck disable=SC2086
emerge ${EMERGE_FLAGS} "${@}"; return $?
}
__gentoo_pre_dep() {
@ -7043,52 +7054,142 @@ __gentoo_pre_dep() {
if [ ! -d /etc/portage ]; then
mkdir /etc/portage
fi
# Enable python 3.6 if installing pre Neon Salt release
if echo "${STABLE_REV}" | grep -q "2019" || [ "${ITYPE}" = "git" ] && [ "${_POST_NEON_INSTALL}" -eq $BS_FALSE ]; then
if ! emerge --info | sed 's/.*\(PYTHON_TARGETS="[^"]*"\).*/\1/' | grep -q 'python3_6' ; then
echo "PYTHON_TARGETS=\"\${PYTHON_TARGETS} python3_6\"" >> /etc/portage/make.conf
fi
fi
}
__gentoo_post_dep() {
# ensures dev-lib/crypto++ compiles happily
__emerge --oneshot 'sys-devel/libtool'
# the -o option asks it to emerge the deps but not the package.
__gentoo_config_protection
if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then
__autounmask 'dev-python/libcloud'
__emerge -v 'dev-python/libcloud'
fi
__autounmask 'dev-python/requests'
__autounmask 'app-admin/salt'
__emerge -vo 'dev-python/requests'
__emerge -vo 'app-admin/salt'
if [ "${_EXTRA_PACKAGES}" != "" ]; then
echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}"
# shellcheck disable=SC2086
__autounmask ${_EXTRA_PACKAGES} || return 1
# shellcheck disable=SC2086
__emerge -v ${_EXTRA_PACKAGES} || return 1
__emerge ${_EXTRA_PACKAGES} || return 1
fi
return 0
}
install_gentoo_deps() {
__gentoo_pre_dep || return 1
# Make sure that the 'libcloud' use flag is set when Salt Cloud support is requested
if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then
SALT_USE_FILE='/etc/portage/package.use'
if [ -d '/etc/portage/package.use' ]; then
SALT_USE_FILE='/etc/portage/package.use/salt'
fi
SALT_USE_FLAGS="$(grep -E '^[<>=~]*app-admin/salt.*' ${SALT_USE_FILE} 2>/dev/null)"
SALT_USE_FLAG_LIBCLOUD="$(echo "${SALT_USE_FLAGS}" | grep ' libcloud' 2>/dev/null)"
# Set the libcloud use flag, if it is not set yet
if [ -z "${SALT_USE_FLAGS}" ]; then
echo "app-admin/salt libcloud" >> ${SALT_USE_FILE}
elif [ -z "${SALT_USE_FLAG_LIBCLOUD}" ]; then
sed 's#^\([<>=~]*app-admin/salt[^ ]*\)\(.*\)#\1 libcloud\2#g' -i ${SALT_USE_FILE}
fi
fi
__gentoo_post_dep || return 1
}
install_gentoo_git_deps() {
__gentoo_pre_dep || return 1
GENTOO_GIT_PACKAGES=""
# Install pip if it does not exist
if ! __check_command_exists pip ; then
GENTOO_GIT_PACKAGES="${GENTOO_GIT_PACKAGES} dev-python/pip"
fi
# Install GIT if it does not exist
if ! __check_command_exists git ; then
GENTOO_GIT_PACKAGES="${GENTOO_GIT_PACKAGES} dev-vcs/git"
fi
# Salt <3000 does not automatically install dependencies. It has to be done manually.
if [ "${_POST_NEON_INSTALL}" -eq $BS_FALSE ]; then
# Install Python 3.6 if it does not exist
if ! __check_command_exists python3.6 ; then
GENTOO_GIT_PACKAGES="${GENTOO_GIT_PACKAGES} dev-lang/python:3.6"
fi
GENTOO_GIT_PACKAGES="${GENTOO_GIT_PACKAGES}
sys-apps/pciutils
dev-python/pyyaml
dev-python/pyzmq
dev-python/libnacl
dev-python/pycryptodome
dev-python/py
dev-python/requests
dev-python/msgpack
dev-python/jinja
dev-python/pyasn1
dev-python/markupsafe
dev-python/cython
dev-python/six
dev-python/idna
dev-python/pycurl
<www-servers/tornado-5.0"
fi
# Install libcloud when Salt Cloud support was requested
if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then
GENTOO_GIT_PACKAGES="${GENTOO_GIT_PACKAGES} dev-python/libcloud"
fi
if [ -n "${GENTOO_GIT_PACKAGES}" ]; then
# shellcheck disable=SC2086
__autounmask ${GENTOO_GIT_PACKAGES} || return 1
# shellcheck disable=SC2086
__emerge ${GENTOO_GIT_PACKAGES} || return 1
fi
__git_clone_and_checkout || return 1
__gentoo_post_dep || return 1
}
install_gentoo_stable() {
__gentoo_config_protection
__emerge -v 'app-admin/salt' || return 1
GENTOO_SALT_PACKAGE="app-admin/salt"
STABLE_REV_WITHOUT_PREFIX=$(echo "${STABLE_REV}" | sed 's#archive/##')
if [ "${STABLE_REV_WITHOUT_PREFIX}" != "latest" ]; then
GENTOO_SALT_PACKAGE="=app-admin/salt-${STABLE_REV_WITHOUT_PREFIX}*"
fi
# shellcheck disable=SC2086
__autounmask ${GENTOO_SALT_PACKAGE} || return 1
# shellcheck disable=SC2086
__emerge ${GENTOO_SALT_PACKAGE} || return 1
}
install_gentoo_git() {
__gentoo_config_protection
__emerge -v '=app-admin/salt-9999' || return 1
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
__install_salt_from_repo_post_neon "${_PY_EXE}" || return 1
return 0
fi
# Tornado 4.3 ebuild supports only Python 3.6, use Python 3.6 as the default Python 3 interpreter
if [ "$_PY_EXE" = "python3" ] || [ -z "$_PY_EXE" ]; then
_PYEXE=python3.6
else
_PYEXE=${_PY_EXE}
fi
if [ -f "${_SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then
"${_PYEXE}" setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" ${SETUP_PY_INSTALL_ARGS} install || return 1
else
"${_PYEXE}" setup.py ${SETUP_PY_INSTALL_ARGS} install || return 1
fi
return 0
}
install_gentoo_post() {
@ -7101,47 +7202,84 @@ install_gentoo_post() {
[ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
if [ -d "/run/systemd/system" ]; then
systemctl enable salt-$fname.service
systemctl start salt-$fname.service
if __check_command_exists systemctl ; then
systemctl is-enabled salt-$fname.service > /dev/null 2>&1 || (
systemctl preset salt-$fname.service > /dev/null 2>&1 &&
systemctl enable salt-$fname.service > /dev/null 2>&1
)
else
rc-update add salt-$fname default
/etc/init.d/salt-$fname start
# Salt minion cannot start in a docker container because the "net" service is not available
if [ $fname = "minion" ] && [ -f /.dockerenv ]; then
sed '/need net/d' -i /etc/init.d/salt-$fname
fi
rc-update add "salt-$fname" > /dev/null 2>&1 || return 1
fi
done
}
install_gentoo_git_post() {
for fname in api master minion syndic; do
# Skip if not meant to be installed
[ $fname = "api" ] && \
([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue
[ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
if __check_command_exists systemctl ; then
__copyfile "${_SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.service" "/lib/systemd/system/salt-${fname}.service"
# Skip salt-api since the service should be opt-in and not necessarily started on boot
[ $fname = "api" ] && continue
systemctl is-enabled salt-$fname.service > /dev/null 2>&1 || (
systemctl preset salt-$fname.service > /dev/null 2>&1 &&
systemctl enable salt-$fname.service > /dev/null 2>&1
)
else
cat <<_eof > "/etc/init.d/salt-${fname}"
#!/sbin/openrc-run
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
command="/usr/bin/salt-${fname}"
command_args="\${SALT_OPTS}"
command_background="1"
pidfile="/var/run/salt-${fname}.pid"
name="SALT ${fname} daemon"
retry="20"
depend() {
use net logger
}
_eof
chmod +x /etc/init.d/salt-$fname
cat <<_eof > "/etc/conf.d/salt-${fname}"
# /etc/conf.d/salt-${fname}: config file for /etc/init.d/salt-master
# see man pages for salt-${fname} or run 'salt-${fname} --help'
# for valid cmdline options
SALT_OPTS="--log-level=warning"
_eof
# Skip salt-api since the service should be opt-in and not necessarily started on boot
[ $fname = "api" ] && continue
rc-update add "salt-$fname" > /dev/null 2>&1 || return 1
fi
done
return 0
}
install_gentoo_restart_daemons() {
[ $_START_DAEMONS -eq $BS_FALSE ] && return
for fname in api master minion syndic; do
# Skip salt-api since the service should be opt-in and not necessarily started on boot
[ $fname = "api" ] && continue
# Skip if not meant to be installed
[ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
if [ -d "/run/systemd/system" ]; then
systemctl stop salt-$fname > /dev/null 2>&1
systemctl start salt-$fname.service && continue
echodebug "Failed to start salt-$fname using systemd"
if [ "$_ECHO_DEBUG" -eq $BS_TRUE ]; then
systemctl status salt-$fname.service
journalctl -xe
fi
else
/etc/init.d/salt-$fname stop > /dev/null 2>&1
/etc/init.d/salt-$fname start
fi
done
}
install_gentoo_check_services() {
if [ ! -d "/run/systemd/system" ]; then
# Not running systemd!? Don't check!
return 0
# Ensure upstart configs / systemd units are loaded
if __check_command_exists systemctl ; then
systemctl daemon-reload
fi
for fname in api master minion syndic; do
@ -7153,7 +7291,39 @@ install_gentoo_check_services() {
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
__check_services_systemd salt-$fname || return 1
if __check_command_exists systemctl ; then
systemctl stop salt-$fname > /dev/null 2>&1
systemctl start salt-$fname.service && continue
echodebug "Failed to start salt-$fname using systemd"
if [ "$_ECHO_DEBUG" -eq $BS_TRUE ]; then
systemctl status salt-$fname.service
journalctl -xe
fi
else
# Disable stdin to fix shell session hang on killing tee pipe
rc-service salt-$fname stop < /dev/null > /dev/null 2>&1
rc-service salt-$fname start < /dev/null || return 1
fi
done
return 0
}
install_gentoo_check_services() {
for fname in api master minion syndic; do
# Skip salt-api since the service should be opt-in and not necessarily started on boot
[ $fname = "api" ] && continue
# Skip if not meant to be installed
[ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
if __check_command_exists systemctl ; then
__check_services_systemd salt-$fname || return 1
else
__check_services_openrc salt-$fname || return 1
fi
done
return 0