Переглянути джерело

Merge "Implement repo.pinning logic"

pull/138/merge
Vasyl Saienko 6 роки тому
джерело
коміт
173e7eb859
4 змінених файлів з 55 додано та 4 видалено
  1. +25
    -0
      README.rst
  2. +13
    -3
      linux/files/preferences_repo
  3. +1
    -1
      linux/system/repo.sls
  4. +16
    -0
      tests/pillar/system.sls

+ 25
- 0
README.rst Переглянути файл

@@ -918,6 +918,31 @@ Also pin it's packages with priority ``900``:
priority: 900
package: '*'

If you need to add multiple pin rules for one repo, please use new,ordered definition format
('pinning' definition will be in priotity to use):

.. code-block:: yaml

linux:
system:
repo:
mcp_saltstack:
source: "deb [arch=amd64] http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2017.7/ xenial main"
architectures: amd64
clean_file: true
pinning:
10:
enabled: true
pin: 'release o=SaltStack'
priority: 50
package: 'libsodium18'
20:
enabled: true
pin: 'release o=SaltStack'
priority: 1100
package: '*'


.. note:: For old Ubuntu releases (<xenial)
extra packages for apt transport, like ``apt-transport-https``
may be required to be installed manually.

+ 13
- 3
linux/files/preferences_repo Переглянути файл

@@ -1,8 +1,18 @@
{%- from "linux/map.jinja" import system with context %}
{%- set repo = system.repo[repo_name] %}
{%- for pin in repo.pin %}
{%- set package = pin.get('package', '*') %}
{%- if repo.pinning is defined %}
{%- for id,pin in repo.pinning|dictsort %}
{%- if pin.get('enabled', False) %}
Package: {{ pin.get('package','*') }}
Pin: {{ pin.pin }}
Pin-Priority: {{ pin.priority }}
{%- endif %}
{% endfor %}
{%- elif repo.pin is defined %}
{%- for pin in repo.pin %}
{%- set package = pin.get('package', '*') %}
Package: {{ package }}
Pin: {{ pin.pin }}
Pin-Priority: {{ pin.priority }}
{% endfor %}
{% endfor %}
{%- endif %}

+ 1
- 1
linux/system/repo.sls Переглянути файл

@@ -57,7 +57,7 @@ purge_sources_list_d_repos:
file.absent
{%- endif %}

{%- if repo.pin is defined %}
{%- if repo.pin is defined or repo.pinning is defined %}
linux_repo_{{ name }}_pin:
file.managed:
- name: /etc/apt/preferences.d/{{ name }}

+ 16
- 0
tests/pillar/system.sls Переглянути файл

@@ -202,6 +202,22 @@ linux:
proxy:
enabled: true
https: https://127.0.5.1:443
saltstack:
source: "deb [arch=amd64] http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2017.7/ xenial main"
key_url: "http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2017.7/SALTSTACK-GPG-KEY.pub"
architectures: amd64
clean_file: true
pinning:
10:
enabled: true
pin: 'release o=SaltStack'
priority: 50
package: 'libsodium18'
20:
enabled: true
pin: 'release o=SaltStack'
priority: 1100
package: '*'
opencontrail:
source: "deb http://ppa.launchpad.net/tcpcloud/contrail-3.0/ubuntu xenial main"
keyid: E79EE90C

Завантаження…
Відмінити
Зберегти