44# Author: Daniel Dehennin <[email protected] > 55# Copyright (C) 2020 Daniel Dehennin <[email protected] > 66
7+ # rubocop:disable Metrics/ClassLength
78class SystemResource < Inspec . resource ( 1 )
89 name 'system'
910
@@ -21,7 +22,8 @@ def build_platform
2122 family : build_platform_family ,
2223 name : build_platform_name ,
2324 release : build_platform_release ,
24- finger : build_platform_finger
25+ finger : build_platform_finger ,
26+ codename : build_platform_codename
2527 }
2628 end
2729
@@ -89,4 +91,44 @@ def build_finger_release
8991 build_platform_release . split ( '.' ) [ 0 ]
9092 end
9193 end
94+
95+ # rubocop:disable Metrics/MethodLength,Metrics/CyclomaticComplexity
96+ def build_platform_codename
97+ case build_platform_finger
98+ when 'ubuntu-20.04'
99+ 'focal'
100+ when 'ubuntu-18.04'
101+ 'bionic'
102+ when 'debian-11'
103+ 'bullseye'
104+ when 'debian-10'
105+ 'buster'
106+ when 'debian-9'
107+ 'stretch'
108+ when 'almalinux-8'
109+ "AlmaLinux #{ build_platform_release } (Arctic Sphynx)"
110+ when 'amazonlinux-2'
111+ 'Amazon Linux 2'
112+ when 'arch-base-latest'
113+ 'Arch Linux'
114+ when 'centos-7'
115+ 'CentOS Linux 7 (Core)'
116+ when 'centos-8'
117+ 'CentOS Stream 8'
118+ when 'opensuse-tumbleweed'
119+ 'openSUSE Tumbleweed'
120+ when 'opensuse-15'
121+ "openSUSE Leap #{ build_platform_release } "
122+ when 'oraclelinux-8' , 'oraclelinux-7'
123+ "Oracle Linux Server #{ build_platform_release } "
124+ when 'gentoo-2-sysd' , 'gentoo-2-sysv'
125+ 'Gentoo/Linux'
126+ when 'rockylinux-8'
127+ "Rocky Linux #{ build_platform_release } (Green Obsidian)"
128+ else
129+ ''
130+ end
131+ end
132+ # rubocop:enable Metrics/MethodLength,Metrics/CyclomaticComplexity
92133end
134+ # rubocop:enable Metrics/ClassLength
0 commit comments