Skip to content

Commit

Permalink
fix(pkg): epel fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SchoolGuy committed Nov 17, 2023
1 parent 0d079ef commit bdefec8
Show file tree
Hide file tree
Showing 23 changed files with 437 additions and 75 deletions.
22 changes: 11 additions & 11 deletions cobbler/files/default/settings.yaml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ bootloaders_modules:
- gcry_rijndael
- gcry_sha1
- gcry_sha256
syslinux_dir: '@@syslinux_dir@@'
syslinux_memdisk_folder: '@@memdisk_folder@@'
syslinux_pxelinux_folder: '@@pxelinux_folder@@'
grub2_mod_dir: '@@grub_mod_folder@@'
bootloaders_shim_folder: '@@shim_folder@@'
bootloaders_shim_file: '@@shim_file@@'
bootloaders_ipxe_folder: '@@ipxe_folder@@'
syslinux_dir: {{ cobbler['bootloaders']['syslinux']['location']|yaml_encode }}
syslinux_memdisk_folder: {{ cobbler['bootloaders']['syslinux']['memdisk_location']|yaml_encode }}
syslinux_pxelinux_folder: {{ cobbler['bootloaders']['syslinux']['pxelinux_location']|yaml_encode }}
grub2_mod_dir: {{ cobbler['bootloaders']['grub2']['mod_location']|yaml_encode }}
bootloaders_shim_folder: {{ cobbler['bootloaders']['shim']['location']|yaml_encode }}
bootloaders_shim_file: {{ cobbler['bootloaders']['shim']['file']|yaml_encode }}
bootloaders_ipxe_folder: {{ cobbler['bootloaders']['ipxe']['location']|yaml_encode }}
build_reporting_enabled: false
build_reporting_sender: ""
build_reporting_email: [ 'root@localhost' ]
Expand All @@ -125,7 +125,7 @@ default_virt_bridge: xenbr0
default_virt_file_size: 5.0
default_virt_ram: 512
default_virt_type: xenpv
enable_ipxe: {{ cobbler['ipxe']['enabled']|yaml_encode }}
enable_ipxe: {{ cobbler['bootloaders']['ipxe']['enabled']|yaml_encode }}
enable_menu: {{ cobbler['menu']['enabled']|yaml_encode }}
http_port: 80
kernel_options: {}
Expand Down Expand Up @@ -160,12 +160,12 @@ next_server_v4: {{ cobbler['nextserver']['v4']|yaml_dquote }}
next_server_v6: {{ cobbler['nextserver']['v6']|yaml_dquote }}
manage_dns: {{ cobbler['dns']['enabled']|yaml_encode }}
bind_chroot_path: ""
bind_zonefile_path: "@@bind_zonefiles@@"
bind_zonefile_path: {{ cobbler['dns']['bind']['location']|yaml_encode }}
bind_master: {{ cobbler['dns']['bind']['master']|yaml_encode }}
manage_forward_zones: []
manage_reverse_zones: []
manage_tftpd: {{ cobbler['tftp']['enabled']|yaml_encode }}
tftpboot_location: "@@tftproot@@"
tftpboot_location: {{ cobbler['tftp']['location']|yaml_encode }}
manage_rsync: {{ cobbler['rsync']['enabled']|yaml_encode }}
power_management_default_type: {{ cobbler['power_management']['default_type']|yaml_dquote }}
pxe_just_once: true
Expand All @@ -187,7 +187,7 @@ server: {{ cobbler['server'] }}
client_use_localhost: false
client_use_https: false
virt_auto_boot: true
webdir: "@@webroot@@/cobbler"
webdir: "{{ cobbler['webdir'] }}/cobbler"
webdir_whitelist:
- misc
- web
Expand Down
14 changes: 9 additions & 5 deletions cobbler/package/install.sls
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,29 @@
{%- from tplroot ~ "/map.jinja" import mapdata as cobbler with context %}
{%- set sls_repo_available = tplroot ~ '.package.repository' %}
{% if cobbler.pkg.epel.enabled %}
{%- if cobbler.pkg.epel.enabled %}
include:
- epel
{%- if grains["osfinger"] == "CentOS Linux-8" %}
cobbler-package-install-pkg-enable-dnf-module:
cmd.run:
- name: dnf module enable cobbler
- unless: dnf module list --enabled | grep cobbler
- require:
- pkg: epel_release
{% endif %}
{%- endif %}
{%- endif %}
cobbler-package-install-pkg-installed:
pkg.installed:
- name: {{ cobbler.pkg.name }}
{% if cobbler.pkg.communityrepo.enabled %}
{%- if cobbler.pkg.communityrepo.enabled %}
- require:
- sls: {{ sls_repo_available }}
{% elif cobbler.pkg.epel.enabled %}
{%- elif cobbler.pkg.epel.enabled %}
# Isn't supported by the yum backend of Salt. We are using osfinger parameter files to fix this. :(
# - resolve_capabilities: true
- require:
- pkg: epel_release
{% endif %}
{%- endif %}
18 changes: 16 additions & 2 deletions cobbler/parameters/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,20 @@ values:
authorization:
module: "allowall"
default_ownership: "admin"
ipxe:
enabled: false
bootloaders:
syslinux:
location: "/usr/share/syslinux"
memdisk_location: "/usr/share/syslinux"
pxelinux_location: "/usr/share/syslinux"
grub2:
mod_location: "/usr/share/grub2"
shim:
location: "/usr/share/efi/*/"
# This is YAML as such we need a double backslash to get a single one.
file: "shim\\.efi"
ipxe:
enabled: false
location: /usr/share/ipxe/
dhcp:
v4: false
v6: false
Expand All @@ -41,6 +53,7 @@ values:
enabled: false
module: "bind"
bind:
location: /var/lib/named
master: "127.0.0.1"
forward_zones: []
reverse_zones: []
Expand All @@ -61,3 +74,4 @@ values:
author: "cobbler <cobbler@localhost>"
push_script: "/bin/true"
config: /etc/cobbler/settings.yaml
webdir: /var/www
3 changes: 3 additions & 0 deletions cobbler/parameters/os/Ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
# values: {}
---
values:
dns:
bind:
location: /etc/bind/db.
tftp:
location: /var/lib/tftpboot
...
8 changes: 8 additions & 0 deletions cobbler/parameters/os_family/Debian.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
# values: {}
---
values:
bootloaders:
ipxe:
location: "/usr/lib/ipxe/"
shim:
location: "/usr/lib/shim/"
file: "shim.*\\.efi\\.signed"
syslinux:
location: "/usr/lib/syslinux/modules/bios/"
pkg:
communityrepo:
enabled: true
Expand Down
3 changes: 3 additions & 0 deletions cobbler/parameters/os_family/RedHat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
# values: {}
---
values:
dns:
bind:
location: /var/named
pkg:
epel:
enabled: true
Expand Down
3 changes: 2 additions & 1 deletion cobbler/parameters/os_family/Suse.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
# you can remove this file or provide at least an empty dict, e.g.
# values: {}
---
values: {}
values:
webdir: /srv/www
...
17 changes: 17 additions & 0 deletions cobbler/parameters/osfinger/AlmaLinux-8.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
#
# Set values specific to:
# salt['config.get']('osfinger') == AlmaLinux-8.
#
# You just need to add the key:values for this `osfinger` that differ
# from `defaults.yaml`.
#
# If you do not need to provide defaults via the `osfinger` config,
# you can remove this file or provide at least an empty dict, e.g.
# values: {}
---
values:
pkg:
name: cobbler3.2
...
17 changes: 17 additions & 0 deletions cobbler/parameters/osfinger/AlmaLinux-9.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
#
# Set values specific to:
# salt['config.get']('osfinger') == AlmaLinux-9.
#
# You just need to add the key:values for this `osfinger` that differ
# from `defaults.yaml`.
#
# If you do not need to provide defaults via the `osfinger` config,
# you can remove this file or provide at least an empty dict, e.g.
# values: {}
---
values:
pkg:
name: cobbler3.3
...
17 changes: 17 additions & 0 deletions cobbler/parameters/osfinger/CentOS Stream-8.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
#
# Set values specific to:
# salt['config.get']('osfinger') == CentOS Stream-8.
#
# You just need to add the key:values for this `osfinger` that differ
# from `defaults.yaml`.
#
# If you do not need to provide defaults via the `osfinger` config,
# you can remove this file or provide at least an empty dict, e.g.
# values: {}
---
values:
pkg:
name: cobbler3.2
...
17 changes: 17 additions & 0 deletions cobbler/parameters/osfinger/CentOS Stream-9.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
#
# Set values specific to:
# salt['config.get']('osfinger') == CentOS Stream-9.
#
# You just need to add the key:values for this `osfinger` that differ
# from `defaults.yaml`.
#
# If you do not need to provide defaults via the `osfinger` config,
# you can remove this file or provide at least an empty dict, e.g.
# values: {}
---
values:
pkg:
name: cobbler3.3
...
17 changes: 17 additions & 0 deletions cobbler/parameters/osfinger/Rocky Linux-8.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
#
# Set values specific to:
# salt['config.get']('osfinger') == Rocky Linux-8.
#
# You just need to add the key:values for this `osfinger` that differ
# from `defaults.yaml`.
#
# If you do not need to provide defaults via the `osfinger` config,
# you can remove this file or provide at least an empty dict, e.g.
# values: {}
---
values:
pkg:
name: cobbler3.2
...
17 changes: 17 additions & 0 deletions cobbler/parameters/osfinger/Rocky Linux-9.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
#
# Set values specific to:
# salt['config.get']('osfinger') == Rocky Linux-9.
#
# You just need to add the key:values for this `osfinger` that differ
# from `defaults.yaml`.
#
# If you do not need to provide defaults via the `osfinger` config,
# you can remove this file or provide at least an empty dict, e.g.
# values: {}
---
values:
pkg:
name: cobbler3.3
...
14 changes: 13 additions & 1 deletion test/integration/default/controls/packages.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
# frozen_string_literal: true

# Prepare platform "finger"
platform_finger = system.platform[:finger].split('.').first.to_s

control 'cobbler.package.install' do
title 'The required package should be installed'

package_name = 'cobbler'
# Override by `platform_finger`
package_name =
case platform_finger
when 'centos-8', 'rockylinux-8', 'almalinux-8'
'cobbler3.2'
when 'centos-9', 'rockylinux-9', 'almalinux-9'
'cobbler3.3'
else
'cobbler'
end

describe package(package_name) do
it { should be_installed }
Expand Down
Loading

0 comments on commit bdefec8

Please sign in to comment.