| {# Don't remove newlines between rules! |
| Input variables might be: `pin_dict` OR `repo_id` |
| For both usage example, see README.md #} |
| {%- from "linux/map.jinja" import system with context -%} |
| {%- if pin_dict is defined %} |
| {%- set pin_dict_inted = salt['sharedlib.call']('misc.cast_dict_keys_to_int', pin_dict ) %} |
| {%- for id,pin in pin_dict_inted|dictsort -%} |
| {%- if pin.get('enabled', False) %} |
| |
| # Pining rule: {%- if pin.get('name', False) %}{{ pin.name }}{% else %}noname{%- endif %} |
| Package: {{ pin.get('package','*') }} |
| Pin: {{ pin.pin }} |
| Pin-Priority: {{ pin.priority }} |
| {%- endif %} |
| {%- endfor -%} |
| {% elif repo_id is defined -%} |
| {%- set repo = system.get('repo',{}).get(repo_id, {}) -%} |
| {%- 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 %} |
| {%- endif -%} |
| {% endif -%} |
| {# |
| # vim: ft=jinja |
| #} |