From 990456037d361becb93a76f316ff3c5cd40f29c5 Mon Sep 17 00:00:00 2001 From: Didier METRAL Date: Wed, 31 Jan 2024 16:47:20 +0100 Subject: [PATCH] BREAKING CHANGE: update for onedir salt package. Old standard salt package is no more maintained. --- libvirt/parameters/defaults.yaml | 3 +- libvirt/parameters/os/AlmaLinux.yaml | 14 -------- libvirt/parameters/os/CentOS.yaml | 14 -------- libvirt/parameters/os/Fedora.yaml | 14 -------- libvirt/parameters/os/Rocky.yaml | 14 -------- libvirt/parameters/os_family/Arch.yaml | 3 +- libvirt/parameters/os_family/Debian.yaml | 3 +- libvirt/parameters/os_family/RedHat.yaml | 2 ++ libvirt/parameters/os_family/Suse.yaml | 4 +-- .../oscodename/openSUSE Tumbleweed.yaml | 16 --------- .../parameters/osfinger/CentOS Linux-7.yaml | 15 -------- libvirt/python.jinja | 34 ------------------- libvirt/python/clean.sls | 10 ++---- libvirt/python/install.sls | 13 +++---- libvirt/server/tls/certs.sls | 12 +------ 15 files changed, 17 insertions(+), 154 deletions(-) delete mode 100644 libvirt/parameters/os/AlmaLinux.yaml delete mode 100644 libvirt/parameters/os/CentOS.yaml delete mode 100644 libvirt/parameters/os/Fedora.yaml delete mode 100644 libvirt/parameters/os/Rocky.yaml delete mode 100644 libvirt/parameters/oscodename/openSUSE Tumbleweed.yaml delete mode 100644 libvirt/parameters/osfinger/CentOS Linux-7.yaml delete mode 100644 libvirt/python.jinja diff --git a/libvirt/parameters/defaults.yaml b/libvirt/parameters/defaults.yaml index 265d448..70ddd9f 100644 --- a/libvirt/parameters/defaults.yaml +++ b/libvirt/parameters/defaults.yaml @@ -14,8 +14,7 @@ values: - id libvirt_pkg: libvirt qemu_pkg: qemu - python2_pkg: libvirt-python - python3_pkg: python3-libvirt + pip_pkg: libvirt-python libvirt_service: libvirtd libvirtd_config: /etc/libvirt/libvirtd.conf daemon_config_path: {} diff --git a/libvirt/parameters/os/AlmaLinux.yaml b/libvirt/parameters/os/AlmaLinux.yaml deleted file mode 100644 index 932cb1c..0000000 --- a/libvirt/parameters/os/AlmaLinux.yaml +++ /dev/null @@ -1,14 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=yaml -# -# Setup variables specific to salt['config.get']('os') == CentOS. -# You just need to add the key:values for this `os` that differ -# from `defaults.yaml` + `.yaml` + `.yaml`. -# -# If you do not need to provide defaults via the `os` config, -# you can remove this file or provide at least an empty dict, e.g. -# values: {} ---- -values: - python2_pkg: ~ -... diff --git a/libvirt/parameters/os/CentOS.yaml b/libvirt/parameters/os/CentOS.yaml deleted file mode 100644 index 932cb1c..0000000 --- a/libvirt/parameters/os/CentOS.yaml +++ /dev/null @@ -1,14 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=yaml -# -# Setup variables specific to salt['config.get']('os') == CentOS. -# You just need to add the key:values for this `os` that differ -# from `defaults.yaml` + `.yaml` + `.yaml`. -# -# If you do not need to provide defaults via the `os` config, -# you can remove this file or provide at least an empty dict, e.g. -# values: {} ---- -values: - python2_pkg: ~ -... diff --git a/libvirt/parameters/os/Fedora.yaml b/libvirt/parameters/os/Fedora.yaml deleted file mode 100644 index 77b0c73..0000000 --- a/libvirt/parameters/os/Fedora.yaml +++ /dev/null @@ -1,14 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=yaml -# -# Setup variables specific to salt['config.get']('os') == Fedora. -# You just need to add the key:values for this `os` that differ -# from `defaults.yaml` + `.yaml` + `.yaml`. -# -# If you do not need to provide defaults via the `os` config, -# you can remove this file or provide at least an empty dict, e.g. -# values: {} ---- -values: - python2_pkg: python2-libvirt -... diff --git a/libvirt/parameters/os/Rocky.yaml b/libvirt/parameters/os/Rocky.yaml deleted file mode 100644 index 932cb1c..0000000 --- a/libvirt/parameters/os/Rocky.yaml +++ /dev/null @@ -1,14 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=yaml -# -# Setup variables specific to salt['config.get']('os') == CentOS. -# You just need to add the key:values for this `os` that differ -# from `defaults.yaml` + `.yaml` + `.yaml`. -# -# If you do not need to provide defaults via the `os` config, -# you can remove this file or provide at least an empty dict, e.g. -# values: {} ---- -values: - python2_pkg: ~ -... diff --git a/libvirt/parameters/os_family/Arch.yaml b/libvirt/parameters/os_family/Arch.yaml index 36427f2..a87fce2 100644 --- a/libvirt/parameters/os_family/Arch.yaml +++ b/libvirt/parameters/os_family/Arch.yaml @@ -12,5 +12,6 @@ values: daemon_config_path: /etc/conf.d qemu_pkg: qemu-full - python3_pkg: libvirt-python + extra_pkgs: + - pkgconf ... diff --git a/libvirt/parameters/os_family/Debian.yaml b/libvirt/parameters/os_family/Debian.yaml index bcfa828..0630e27 100644 --- a/libvirt/parameters/os_family/Debian.yaml +++ b/libvirt/parameters/os_family/Debian.yaml @@ -13,10 +13,11 @@ values: libvirt_pkg: libvirt-daemon-system libvirt_service: libvirtd qemu_pkg: qemu-system-x86 - python2_pkg: python-libvirt extra_pkgs: - libguestfs0 - libguestfs-tools - gnutls-bin + - libvirt-dev + - pkg-config daemon_config_path: /etc/default ... diff --git a/libvirt/parameters/os_family/RedHat.yaml b/libvirt/parameters/os_family/RedHat.yaml index 7b09659..cd511a0 100644 --- a/libvirt/parameters/os_family/RedHat.yaml +++ b/libvirt/parameters/os_family/RedHat.yaml @@ -13,5 +13,7 @@ values: qemu_pkg: qemu-kvm extra_pkgs: - libguestfs + - libvirt-devel + - pkgconf daemon_config_path: /etc/sysconfig ... diff --git a/libvirt/parameters/os_family/Suse.yaml b/libvirt/parameters/os_family/Suse.yaml index bfc3fdb..2efbd5b 100644 --- a/libvirt/parameters/os_family/Suse.yaml +++ b/libvirt/parameters/os_family/Suse.yaml @@ -14,7 +14,7 @@ values: qemu_pkg: qemu-kvm extra_pkgs: - libguestfs0 - python2_pkg: python2-libvirt-python - python3_pkg: python3-libvirt-python + - libvirt-devel + - pkg-config daemon_config_path: /etc/sysconfig ... diff --git a/libvirt/parameters/oscodename/openSUSE Tumbleweed.yaml b/libvirt/parameters/oscodename/openSUSE Tumbleweed.yaml deleted file mode 100644 index 4e7afa4..0000000 --- a/libvirt/parameters/oscodename/openSUSE Tumbleweed.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=yaml -# -# Setup variables specific to -# salt['config.get']('oscodename') == openSUSE Tumbleweed. -# You just need to add the key:values for this `oscodename` that differ -# from `defaults.yaml` + `.yaml` + `.yaml` + `.yaml`. -# -# If you do not need to provide defaults via the `oscodename` config, -# you can remove this file or provide at least an empty dict, e.g. -# values: {} ---- -values: - python2_pkg: ~ - python3_pkg: python38-libvirt-python -... diff --git a/libvirt/parameters/osfinger/CentOS Linux-7.yaml b/libvirt/parameters/osfinger/CentOS Linux-7.yaml deleted file mode 100644 index 89d508d..0000000 --- a/libvirt/parameters/osfinger/CentOS Linux-7.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=yaml -# -# Setup variables specific to salt['config.get']('osfinger') == CentOS Linux-7. -# 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: - python2_pkg: libvirt-python - python3_pkg: ~ -... diff --git a/libvirt/python.jinja b/libvirt/python.jinja deleted file mode 100644 index db9c1b4..0000000 --- a/libvirt/python.jinja +++ /dev/null @@ -1,34 +0,0 @@ -{%- macro switch_python32(python3, python2) %} - {#- - Returns arguments depending on the Python environment of the - SaltStack minion. - - A `none` argument is returned as an empty string `''`. - - Params: - * python3: the parameter to return in case of a Python3 minion. - * python2: the parameter to return in case of a Python2 minion. - - Example: - - {%- set package = switch_python32('python3-library', 'python2-library') %} - {%- if package %} - pkg-install-{{ package }}: - pkg.installed: - - name: {{ package }} - {%- endif %} - - The `package` will be `python3-library` when the SaltStack minion - runs under Python3 or `python2-library` otherwise. - #} - {%- if salt['grains.get']('pythonversion')[0] == 3 %} - {%- set selected = python3 %} - {%- else %} - {%- set selected = python2 %} - {%- endif %} - {#- Coerce null value to empty string to make tests simpler #} - {%- if not selected or selected is none -%} - {%- else -%} - {{ selected }} - {%- endif -%} -{%- endmacro -%} diff --git a/libvirt/python/clean.sls b/libvirt/python/clean.sls index 637b9f9..a409751 100644 --- a/libvirt/python/clean.sls +++ b/libvirt/python/clean.sls @@ -4,13 +4,7 @@ {#- Get the `tplroot` from `tpldir` #} {%- set tplroot = tpldir.split('/')[0] %} {%- from tplroot ~ "/map.jinja" import mapdata as libvirt_settings with context %} -{%- from tplroot ~ "/python.jinja" import switch_python32 with context %} -{%- set package = switch_python32(libvirt_settings.python3_pkg, libvirt_settings.python2_pkg) %} - -{#- Some OS do not have the python3 library #} -{%- if package %} libvirt-python-clean-pkg-removed: - pkg.removed: - - name: {{ package }} -{%- endif %} + pip.uninstalled: + - name: {{ libvirt_settings.pip_pkg }} diff --git a/libvirt/python/install.sls b/libvirt/python/install.sls index d2927b7..2d0a329 100644 --- a/libvirt/python/install.sls +++ b/libvirt/python/install.sls @@ -4,13 +4,10 @@ {#- Get the `tplroot` from `tpldir` #} {%- set tplroot = tpldir.split('/')[0] %} {%- from tplroot ~ "/map.jinja" import mapdata as libvirt_settings with context %} -{%- from tplroot ~ "/python.jinja" import switch_python32 with context %} -{%- set package = switch_python32(libvirt_settings.python3_pkg, libvirt_settings.python2_pkg) %} - -{#- Some OS do not have the python3 library #} -{%- if package %} libvirt-python-install-pkg-installed: - pkg.installed: - - name: {{ package }} -{%- endif %} + pip.installed: + - name: {{ libvirt_settings.pip_pkg }} + - require: + - pkg: libvirt-extra-install-pkg-installed + diff --git a/libvirt/server/tls/certs.sls b/libvirt/server/tls/certs.sls index f60cd06..f4bf363 100644 --- a/libvirt/server/tls/certs.sls +++ b/libvirt/server/tls/certs.sls @@ -6,26 +6,16 @@ {%- set sls_python = tplroot ~ '.python' %} {%- set sls_server_config = tplroot ~ '.server.config' %} {%- from tplroot ~ "/map.jinja" import mapdata as libvirt_settings with context %} -{%- from tplroot ~ "/python.jinja" import switch_python32 with context %} -{%- set package = switch_python32(libvirt_settings.python3_pkg, libvirt_settings.python2_pkg) %} {%- set salt_version = salt['grains.get']('saltversioninfo', '') %} -{#- Some OS do not have the python3 library #} -{%- if package %} include: - {{ sls_python }} - {{ sls_server_config }} libvirt-server-tls-certs-virt-keys: -# API changes with version 2016.3.0 -{%- if salt_version[0]|int < 2016 or (salt_version[0]|int == 2016 and salt_version[1]|int <= 3) %} - libvirt.keys: -{%- else %} virt.keys: -{%- endif %} - name: libvirt_keys - require: - pkg: libvirt-server-package-install-pkg-installed - - pkg: libvirt-python-install-pkg-installed -{%- endif %} + - pip: {{ libvirt_settings.pip_pkg }}