test(repository): favor platform over os

This commit is contained in:
Javier Bértoli 2022-02-03 11:47:19 -03:00
parent 8fee9f05bd
commit c16ecf82f5

View File

@ -1,25 +1,20 @@
# frozen_string_literal: true # frozen_string_literal: true
case os.family case platform.family
when 'redhat' when 'redhat'
repo_file = '/etc/yum.repos.d/passenger.repo' repo_file = '/etc/yum.repos.d/passenger.repo'
repo_url = 'https://oss-binaries.phusionpassenger.com/yum/passenger/el/$releasever/$basearch' repo_url = 'https://oss-binaries.phusionpassenger.com/yum/passenger/el/$releasever/$basearch'
when 'debian' when 'debian'
# Inspec does not provide a `codename` matcher, so we add ours # Inspec does not provide a `codename` matcher, so we add ours
case platform[:release].to_f.truncate finger_codename = {
# ubuntu 'ubuntu-18.04' => 'bionic',
when 18 'ubuntu-20.04' => 'focal',
codename = 'bionic' 'debian-9' => 'stretch',
when 20 'debian-10' => 'buster',
codename = 'focal' 'debian-11' => 'bullseye'
# debian }
when 9 codename = finger_codename[system.platform[:finger]]
codename = 'stretch'
when 10
codename = 'buster'
when 11
codename = 'bullseye'
end
repo_keyring = '/usr/share/keyrings/phusionpassenger-archive-keyring.gpg' repo_keyring = '/usr/share/keyrings/phusionpassenger-archive-keyring.gpg'
repo_file = "/etc/apt/sources.list.d/phusionpassenger-official-#{codename}.list" repo_file = "/etc/apt/sources.list.d/phusionpassenger-official-#{codename}.list"
# rubocop:disable Metrics/LineLength # rubocop:disable Metrics/LineLength