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
```
This commit is contained in:
Imran Iqbal 2021-05-25 20:06:01 +01:00
parent 80542bad6e
commit 5146c449d5
No known key found for this signature in database
GPG Key ID: 6D8629439D2B7819
8 changed files with 58 additions and 34 deletions

View File

@ -21,6 +21,7 @@ ignore: |
kitchen.vagrant.yml kitchen.vagrant.yml
salt/osfamilymap.yaml salt/osfamilymap.yaml
salt/osmap.yaml salt/osmap.yaml
salt/osfingermap.yaml
yaml-files: yaml-files:
# Default settings # Default settings

View File

@ -5,14 +5,19 @@
{% import_yaml "salt/defaults.yaml" as defaults %} {% import_yaml "salt/defaults.yaml" as defaults %}
{% import_yaml "salt/osfamilymap.yaml" as osfamilymap %} {% import_yaml "salt/osfamilymap.yaml" as osfamilymap %}
{% import_yaml "salt/osmap.yaml" as osmap %} {% import_yaml "salt/osmap.yaml" as osmap %}
{% import_yaml "salt/osfingermap.yaml" as osfingermap %}
{# merge the osfamilymap #} {# merge the osfamilymap #}
{% set osfamily = salt['grains.filter_by'](osfamilymap, grain='os_family') or{} %} {% set osfamily_map = salt['grains.filter_by'](osfamilymap, grain='os_family') or {} %}
{% do salt['defaults.merge'](defaults['salt'], osfamily) %} {% do salt['defaults.merge'](defaults['salt'], osfamily_map) %}
{# merge the osmap #} {# merge the osmap #}
{% set osmap = salt['grains.filter_by'](osmap, grain='os') or{} %} {% set os_map = salt['grains.filter_by'](osmap, grain='os') or {} %}
{% do salt['defaults.merge'](defaults['salt'], osmap) %} {% 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 #} {# merge the lookup #}
{% set lookup = salt['pillar.get']('salt:lookup', default={}, merge=True) %} {% set lookup = salt['pillar.get']('salt:lookup', default={}, merge=True) %}

18
salt/osfingermap.yaml Normal file
View File

@ -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'

View File

@ -2,18 +2,18 @@
# vim: ft=yaml # 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 osrelease = salt['grains.get']('osrelease', '') %}
{% set salt_release = salt['pillar.get']('salt:release', 'latest') %} {%- set salt_release = salt['pillar.get']('salt:release', 'latest') %}
{% if salt_release.split('.')|length >= 3 %} {%- if salt_release.split('.')|length >= 3 %}
{% set salt_release = 'archive/' ~ salt_release %} {%- set salt_release = 'archive/' ~ salt_release %}
{% endif %} {%- endif %}
{% set os_lower = salt['grains.get']('os')|lower %} {%- set os_lower = salt['grains.get']('os')|lower %}
{% set osmajorrelease = salt['grains.get']('osmajorrelease', osrelease)|string %} {%- set osmajorrelease = salt['grains.get']('osmajorrelease', osrelease)|string %}
{% set oscodename = salt['grains.get']('oscodename') %} {%- set oscodename = salt['grains.get']('oscodename') %}
{% set os_family_lower = salt['grains.get']('os_family')|lower %} {%- set os_family_lower = salt['grains.get']('os_family')|lower %}
{% set salt_repo = salt['pillar.get']('salt:repo', 'https://repo.saltproject.io') %} {%- set salt_repo = salt['pillar.get']('salt:repo', 'https://repo.saltproject.io') %}
Fedora: Fedora:
pygit2: python2-pygit2 pygit2: python2-pygit2
@ -21,12 +21,12 @@ Fedora:
Amazon: Amazon:
pkgrepo_name: saltstack-amzn-repo pkgrepo_name: saltstack-amzn-repo
pkgrepo_humanname: SaltStack repo for Amazon Linux 2 pkgrepo_humanname: SaltStack repo for Amazon Linux 2
pkgrepo: '{{ salt_repo }}/{{ py_ver_dir or 'yum' }}/amazon/2/$basearch/{{ salt_release }}' pkgrepo: '{{ salt_repo }}/{{ py_ver_repr 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' key_url: '{{ salt_repo }}/{{ py_ver_repr or 'yum' }}/amazon/2/$basearch/{{ salt_release }}/SALTSTACK-GPG-KEY.pub'
Ubuntu: Ubuntu:
pkgrepo: 'deb {{ salt_repo }}/{{ py_ver_dir or 'apt' }}/{{ os_lower }}/{{ osrelease }}/amd64/{{ salt_release }} {{ oscodename }} main' pkgrepo: 'deb {{ salt_repo }}/{{ py_ver_repr 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' key_url: '{{ salt_repo }}/{{ py_ver_repr or 'apt' }}/{{ os_lower }}/{{ osrelease }}/amd64/{{ salt_release }}/SALTSTACK-GPG-KEY.pub'
pygit2: python-pygit2 pygit2: python-pygit2
gitfs: gitfs:
pygit2: pygit2:
@ -36,8 +36,8 @@ Ubuntu:
install_from_package: Null install_from_package: Null
Raspbian: Raspbian:
pkgrepo: 'deb {{ salt_repo }}/{{ py_ver_dir or 'apt' }}/{{ os_family_lower }}/{{ osmajorrelease }}/armhf/{{ salt_release }} {{ oscodename }} main' pkgrepo: 'deb {{ salt_repo }}/{{ py_ver_repr 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' key_url: '{{ salt_repo }}/{{ py_ver_repr or 'apt' }}/{{ os_family_lower }}/{{ osmajorrelease }}/armhf/{{ salt_release }}/SALTSTACK-GPG-KEY.pub'
SmartOS: SmartOS:
salt_master: salt salt_master: salt
@ -49,7 +49,7 @@ SmartOS:
minion_service: 'salt:minion' minion_service: 'salt:minion'
master_service: 'salt:master' master_service: 'salt:master'
api_service: 'salt:api' api_service: 'salt:api'
python_dulwich: {{ py_ver_dir or 'py27' }}{{ '-dulwich' }} python_dulwich: {{ py_ver_repr or 'py27' }}{{ '-dulwich' }}
gitfs: gitfs:
dulwich: dulwich:
install_from_source: false install_from_source: false

View File

@ -42,7 +42,7 @@ values:
version: 0.23.0 version: 0.23.0
version: 0.23.0 version: 0.23.0
install_packages: true 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: master:
ext_pillar: ext_pillar:
- cmd_yaml: cat /etc/salt/yaml - cmd_yaml: cat /etc/salt/yaml
@ -85,8 +85,8 @@ values:
state: running state: running
parallel: true parallel: true
pin_version: false pin_version: false
pkgrepo: https://repo.saltproject.io/py3/redhat/$releasever/$basearch/3000 pkgrepo: https://repo.saltproject.io/py3/redhat/7/$basearch/3000
pkgrepo_humanname: SaltStack repo for RHEL/CentOS $releasever pkgrepo_humanname: SaltStack repo for RHEL/CentOS 7
pkgrepo_name: saltstack pkgrepo_name: saltstack
py_ver: py3 py_ver: py3
pygit2: python-pygit2 pygit2: python-pygit2

View File

@ -42,7 +42,7 @@ values:
version: 0.23.0 version: 0.23.0
version: 0.23.0 version: 0.23.0
install_packages: true 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: master:
ext_pillar: ext_pillar:
- cmd_yaml: cat /etc/salt/yaml - cmd_yaml: cat /etc/salt/yaml
@ -85,8 +85,8 @@ values:
state: running state: running
parallel: true parallel: true
pin_version: false pin_version: false
pkgrepo: https://repo.saltproject.io/py3/redhat/$releasever/$basearch/3001 pkgrepo: https://repo.saltproject.io/py3/redhat/7/$basearch/3001
pkgrepo_humanname: SaltStack repo for RHEL/CentOS $releasever pkgrepo_humanname: SaltStack repo for RHEL/CentOS 7
pkgrepo_name: saltstack pkgrepo_name: saltstack
py_ver: py3 py_ver: py3
pygit2: python-pygit2 pygit2: python-pygit2

View File

@ -42,7 +42,7 @@ values:
version: 0.23.0 version: 0.23.0
version: 0.23.0 version: 0.23.0
install_packages: true 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: master:
ext_pillar: ext_pillar:
- cmd_yaml: cat /etc/salt/yaml - cmd_yaml: cat /etc/salt/yaml
@ -85,8 +85,8 @@ values:
state: running state: running
parallel: true parallel: true
pin_version: false pin_version: false
pkgrepo: https://repo.saltproject.io/py3/redhat/$releasever/$basearch/3002 pkgrepo: https://repo.saltproject.io/py3/redhat/7/$basearch/3002
pkgrepo_humanname: SaltStack repo for RHEL/CentOS $releasever pkgrepo_humanname: SaltStack repo for RHEL/CentOS 7
pkgrepo_name: saltstack pkgrepo_name: saltstack
py_ver: py3 py_ver: py3
pygit2: python-pygit2 pygit2: python-pygit2

View File

@ -42,7 +42,7 @@ values:
version: 0.23.0 version: 0.23.0
version: 0.23.0 version: 0.23.0
install_packages: true 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: master:
ext_pillar: ext_pillar:
- cmd_yaml: cat /etc/salt/yaml - cmd_yaml: cat /etc/salt/yaml
@ -85,8 +85,8 @@ values:
state: running state: running
parallel: true parallel: true
pin_version: false pin_version: false
pkgrepo: https://repo.saltproject.io/py3/redhat/$releasever/$basearch/3003 pkgrepo: https://repo.saltproject.io/py3/redhat/7/$basearch/3003
pkgrepo_humanname: SaltStack repo for RHEL/CentOS $releasever pkgrepo_humanname: SaltStack repo for RHEL/CentOS 7
pkgrepo_name: saltstack pkgrepo_name: saltstack
py_ver: py3 py_ver: py3
pygit2: python-pygit2 pygit2: python-pygit2