From 5146c449d5d2d00ba4da67567d74966c21f394a8 Mon Sep 17 00:00:00 2001 From: Imran Iqbal Date: Tue, 25 May 2021 20:06:01 +0100 Subject: [PATCH] fix(oracle-7): use `osmajorrelease` instead of `$releasever` Avoid this error: ``` ID: salt-master Function: pkg.installed Result: False Comment: Error occurred installing package(s). Additional info follows: errors: - Running scope as unit run-402.scope. Loaded plugins: ovl, ulninfo https://repo.saltproject.io/py3/redhat/7Server/x86_64/3002/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found Trying other mirror. No package salt-master available. Error: Nothing to do ``` --- .yamllint | 1 + salt/map.jinja | 13 ++++--- salt/osfingermap.yaml | 18 ++++++++++ salt/osmap.yaml | 36 +++++++++---------- .../files/_mapdata/oraclelinux-7.yaml | 6 ++-- .../files/_mapdata/oraclelinux-7.yaml | 6 ++-- .../files/_mapdata/oraclelinux-7.yaml | 6 ++-- .../files/_mapdata/oraclelinux-7.yaml | 6 ++-- 8 files changed, 58 insertions(+), 34 deletions(-) create mode 100644 salt/osfingermap.yaml diff --git a/.yamllint b/.yamllint index 7343f1a..bfb11c6 100644 --- a/.yamllint +++ b/.yamllint @@ -21,6 +21,7 @@ ignore: | kitchen.vagrant.yml salt/osfamilymap.yaml salt/osmap.yaml + salt/osfingermap.yaml yaml-files: # Default settings diff --git a/salt/map.jinja b/salt/map.jinja index 67f583d..c26284d 100644 --- a/salt/map.jinja +++ b/salt/map.jinja @@ -5,14 +5,19 @@ {% import_yaml "salt/defaults.yaml" as defaults %} {% import_yaml "salt/osfamilymap.yaml" as osfamilymap %} {% import_yaml "salt/osmap.yaml" as osmap %} +{% import_yaml "salt/osfingermap.yaml" as osfingermap %} {# merge the osfamilymap #} -{% set osfamily = salt['grains.filter_by'](osfamilymap, grain='os_family') or{} %} -{% do salt['defaults.merge'](defaults['salt'], osfamily) %} +{% set osfamily_map = salt['grains.filter_by'](osfamilymap, grain='os_family') or {} %} +{% do salt['defaults.merge'](defaults['salt'], osfamily_map) %} {# merge the osmap #} -{% set osmap = salt['grains.filter_by'](osmap, grain='os') or{} %} -{% do salt['defaults.merge'](defaults['salt'], osmap) %} +{% set os_map = salt['grains.filter_by'](osmap, grain='os') or {} %} +{% do salt['defaults.merge'](defaults['salt'], os_map) %} + +{# merge the osfingermap #} +{% set osfinger_map = salt['grains.filter_by'](osfingermap, grain='osfinger') or {} %} +{% do salt['defaults.merge'](defaults['salt'], osfinger_map) %} {# merge the lookup #} {% set lookup = salt['pillar.get']('salt:lookup', default={}, merge=True) %} diff --git a/salt/osfingermap.yaml b/salt/osfingermap.yaml new file mode 100644 index 0000000..d92030d --- /dev/null +++ b/salt/osfingermap.yaml @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- + +{%- set py_ver_repr = salt['pillar.get']('salt:py_ver', '') %} + +{%- set osrelease = salt['grains.get']('osrelease', '') %} +{%- set salt_release = salt['pillar.get']('salt:release', 'latest') %} +{%- if salt_release.split('.')|length >= 3 %} +{%- set salt_release = 'archive/' ~ salt_release %} +{%- endif %} +{%- set osmajorrelease = salt['grains.get']('osmajorrelease', osrelease)|string %} +{%- set salt_repo = salt['pillar.get']('salt:repo', 'https://repo.saltproject.io') %} + +Oracle Linux Server-7: + pkgrepo_humanname: SaltStack repo for RHEL/CentOS {{ osmajorrelease }} + pkgrepo: '{{ salt_repo }}/{{ py_ver_repr or 'yum' }}/redhat/{{ osmajorrelease }}/$basearch/{{ salt_release }}' + key_url: '{{ salt_repo }}/{{ py_ver_repr or 'yum' }}/redhat/{{ osmajorrelease }}/$basearch/{{ salt_release }}/SALTSTACK-GPG-KEY.pub' diff --git a/salt/osmap.yaml b/salt/osmap.yaml index d797ebb..636bcc8 100644 --- a/salt/osmap.yaml +++ b/salt/osmap.yaml @@ -2,18 +2,18 @@ # vim: ft=yaml --- -{%- set py_ver_dir = salt['pillar.get']('salt:py_ver', '') %} +{%- set py_ver_repr = salt['pillar.get']('salt:py_ver', '') %} -{% set osrelease = salt['grains.get']('osrelease') %} -{% set salt_release = salt['pillar.get']('salt:release', 'latest') %} -{% if salt_release.split('.')|length >= 3 %} -{% set salt_release = 'archive/' ~ salt_release %} -{% endif %} -{% set os_lower = salt['grains.get']('os')|lower %} -{% set osmajorrelease = salt['grains.get']('osmajorrelease', osrelease)|string %} -{% set oscodename = salt['grains.get']('oscodename') %} -{% set os_family_lower = salt['grains.get']('os_family')|lower %} -{% set salt_repo = salt['pillar.get']('salt:repo', 'https://repo.saltproject.io') %} +{%- set osrelease = salt['grains.get']('osrelease', '') %} +{%- set salt_release = salt['pillar.get']('salt:release', 'latest') %} +{%- if salt_release.split('.')|length >= 3 %} +{%- set salt_release = 'archive/' ~ salt_release %} +{%- endif %} +{%- set os_lower = salt['grains.get']('os')|lower %} +{%- set osmajorrelease = salt['grains.get']('osmajorrelease', osrelease)|string %} +{%- set oscodename = salt['grains.get']('oscodename') %} +{%- set os_family_lower = salt['grains.get']('os_family')|lower %} +{%- set salt_repo = salt['pillar.get']('salt:repo', 'https://repo.saltproject.io') %} Fedora: pygit2: python2-pygit2 @@ -21,12 +21,12 @@ Fedora: Amazon: pkgrepo_name: saltstack-amzn-repo pkgrepo_humanname: SaltStack repo for Amazon Linux 2 - pkgrepo: '{{ salt_repo }}/{{ py_ver_dir or 'yum' }}/amazon/2/$basearch/{{ salt_release }}' - key_url: '{{ salt_repo }}/{{ py_ver_dir or 'yum' }}/amazon/2/$basearch/{{ salt_release }}/SALTSTACK-GPG-KEY.pub' + pkgrepo: '{{ salt_repo }}/{{ py_ver_repr or 'yum' }}/amazon/2/$basearch/{{ salt_release }}' + key_url: '{{ salt_repo }}/{{ py_ver_repr or 'yum' }}/amazon/2/$basearch/{{ salt_release }}/SALTSTACK-GPG-KEY.pub' Ubuntu: - pkgrepo: 'deb {{ salt_repo }}/{{ py_ver_dir or 'apt' }}/{{ os_lower }}/{{ osrelease }}/amd64/{{ salt_release }} {{ oscodename }} main' - key_url: '{{ salt_repo }}/{{ py_ver_dir or 'apt' }}/{{ os_lower }}/{{ osrelease }}/amd64/{{ salt_release }}/SALTSTACK-GPG-KEY.pub' + pkgrepo: 'deb {{ salt_repo }}/{{ py_ver_repr or 'apt' }}/{{ os_lower }}/{{ osrelease }}/amd64/{{ salt_release }} {{ oscodename }} main' + key_url: '{{ salt_repo }}/{{ py_ver_repr or 'apt' }}/{{ os_lower }}/{{ osrelease }}/amd64/{{ salt_release }}/SALTSTACK-GPG-KEY.pub' pygit2: python-pygit2 gitfs: pygit2: @@ -36,8 +36,8 @@ Ubuntu: install_from_package: Null Raspbian: - pkgrepo: 'deb {{ salt_repo }}/{{ py_ver_dir or 'apt' }}/{{ os_family_lower }}/{{ osmajorrelease }}/armhf/{{ salt_release }} {{ oscodename }} main' - key_url: '{{ salt_repo }}/{{ py_ver_dir or 'apt' }}/{{ os_family_lower }}/{{ osmajorrelease }}/armhf/{{ salt_release }}/SALTSTACK-GPG-KEY.pub' + pkgrepo: 'deb {{ salt_repo }}/{{ py_ver_repr or 'apt' }}/{{ os_family_lower }}/{{ osmajorrelease }}/armhf/{{ salt_release }} {{ oscodename }} main' + key_url: '{{ salt_repo }}/{{ py_ver_repr or 'apt' }}/{{ os_family_lower }}/{{ osmajorrelease }}/armhf/{{ salt_release }}/SALTSTACK-GPG-KEY.pub' SmartOS: salt_master: salt @@ -49,7 +49,7 @@ SmartOS: minion_service: 'salt:minion' master_service: 'salt:master' api_service: 'salt:api' - python_dulwich: {{ py_ver_dir or 'py27' }}{{ '-dulwich' }} + python_dulwich: {{ py_ver_repr or 'py27' }}{{ '-dulwich' }} gitfs: dulwich: install_from_source: false diff --git a/test/integration/v3000-py3/files/_mapdata/oraclelinux-7.yaml b/test/integration/v3000-py3/files/_mapdata/oraclelinux-7.yaml index 0b00c0b..1f0ffac 100644 --- a/test/integration/v3000-py3/files/_mapdata/oraclelinux-7.yaml +++ b/test/integration/v3000-py3/files/_mapdata/oraclelinux-7.yaml @@ -42,7 +42,7 @@ values: version: 0.23.0 version: 0.23.0 install_packages: true - key_url: https://repo.saltproject.io/py3/redhat/$releasever/$basearch/3000/SALTSTACK-GPG-KEY.pub + key_url: https://repo.saltproject.io/py3/redhat/7/$basearch/3000/SALTSTACK-GPG-KEY.pub master: ext_pillar: - cmd_yaml: cat /etc/salt/yaml @@ -85,8 +85,8 @@ values: state: running parallel: true pin_version: false - pkgrepo: https://repo.saltproject.io/py3/redhat/$releasever/$basearch/3000 - pkgrepo_humanname: SaltStack repo for RHEL/CentOS $releasever + pkgrepo: https://repo.saltproject.io/py3/redhat/7/$basearch/3000 + pkgrepo_humanname: SaltStack repo for RHEL/CentOS 7 pkgrepo_name: saltstack py_ver: py3 pygit2: python-pygit2 diff --git a/test/integration/v3001-py3/files/_mapdata/oraclelinux-7.yaml b/test/integration/v3001-py3/files/_mapdata/oraclelinux-7.yaml index fc37170..46431af 100644 --- a/test/integration/v3001-py3/files/_mapdata/oraclelinux-7.yaml +++ b/test/integration/v3001-py3/files/_mapdata/oraclelinux-7.yaml @@ -42,7 +42,7 @@ values: version: 0.23.0 version: 0.23.0 install_packages: true - key_url: https://repo.saltproject.io/py3/redhat/$releasever/$basearch/3001/SALTSTACK-GPG-KEY.pub + key_url: https://repo.saltproject.io/py3/redhat/7/$basearch/3001/SALTSTACK-GPG-KEY.pub master: ext_pillar: - cmd_yaml: cat /etc/salt/yaml @@ -85,8 +85,8 @@ values: state: running parallel: true pin_version: false - pkgrepo: https://repo.saltproject.io/py3/redhat/$releasever/$basearch/3001 - pkgrepo_humanname: SaltStack repo for RHEL/CentOS $releasever + pkgrepo: https://repo.saltproject.io/py3/redhat/7/$basearch/3001 + pkgrepo_humanname: SaltStack repo for RHEL/CentOS 7 pkgrepo_name: saltstack py_ver: py3 pygit2: python-pygit2 diff --git a/test/integration/v3002-py3/files/_mapdata/oraclelinux-7.yaml b/test/integration/v3002-py3/files/_mapdata/oraclelinux-7.yaml index 957f65a..9acc154 100644 --- a/test/integration/v3002-py3/files/_mapdata/oraclelinux-7.yaml +++ b/test/integration/v3002-py3/files/_mapdata/oraclelinux-7.yaml @@ -42,7 +42,7 @@ values: version: 0.23.0 version: 0.23.0 install_packages: true - key_url: https://repo.saltproject.io/py3/redhat/$releasever/$basearch/3002/SALTSTACK-GPG-KEY.pub + key_url: https://repo.saltproject.io/py3/redhat/7/$basearch/3002/SALTSTACK-GPG-KEY.pub master: ext_pillar: - cmd_yaml: cat /etc/salt/yaml @@ -85,8 +85,8 @@ values: state: running parallel: true pin_version: false - pkgrepo: https://repo.saltproject.io/py3/redhat/$releasever/$basearch/3002 - pkgrepo_humanname: SaltStack repo for RHEL/CentOS $releasever + pkgrepo: https://repo.saltproject.io/py3/redhat/7/$basearch/3002 + pkgrepo_humanname: SaltStack repo for RHEL/CentOS 7 pkgrepo_name: saltstack py_ver: py3 pygit2: python-pygit2 diff --git a/test/integration/v3003-py3/files/_mapdata/oraclelinux-7.yaml b/test/integration/v3003-py3/files/_mapdata/oraclelinux-7.yaml index c146d49..d5c555b 100644 --- a/test/integration/v3003-py3/files/_mapdata/oraclelinux-7.yaml +++ b/test/integration/v3003-py3/files/_mapdata/oraclelinux-7.yaml @@ -42,7 +42,7 @@ values: version: 0.23.0 version: 0.23.0 install_packages: true - key_url: https://repo.saltproject.io/py3/redhat/$releasever/$basearch/3003/SALTSTACK-GPG-KEY.pub + key_url: https://repo.saltproject.io/py3/redhat/7/$basearch/3003/SALTSTACK-GPG-KEY.pub master: ext_pillar: - cmd_yaml: cat /etc/salt/yaml @@ -85,8 +85,8 @@ values: state: running parallel: true pin_version: false - pkgrepo: https://repo.saltproject.io/py3/redhat/$releasever/$basearch/3003 - pkgrepo_humanname: SaltStack repo for RHEL/CentOS $releasever + pkgrepo: https://repo.saltproject.io/py3/redhat/7/$basearch/3003 + pkgrepo_humanname: SaltStack repo for RHEL/CentOS 7 pkgrepo_name: saltstack py_ver: py3 pygit2: python-pygit2