mirror of
https://github.com/saltstack-formulas/packages-formula.git
synced 2025-04-17 10:10:27 +00:00
Merge pull request #12 from netmanagers/master
Allow to specify held packages as a list with no version
This commit is contained in:
commit
4a404cb6e8
6 changed files with 28 additions and 8 deletions
|
@ -13,3 +13,7 @@ packages formula
|
|||
|
||||
- Allow to hold/unhold system packages (#8)
|
||||
- Add more tests
|
||||
|
||||
0.0.4 (2018-03-06)
|
||||
|
||||
- Allow to specify held system packages also as a list (#10)
|
||||
|
|
10
README.rst
10
README.rst
|
@ -49,10 +49,12 @@ Runs all the other states in the formula.
|
|||
|
||||
Allows you to manage system's packages. You can specify:
|
||||
|
||||
* ``held``: a dict of `package: version` which will be installed and pinned
|
||||
to that version using SaltStack's `hold/unhold` capability. When upgrading a
|
||||
version, the package will be temporarily unheld, upgraded and then held
|
||||
again.
|
||||
* ``held``: either a list of packages or a dict of `package: version`,
|
||||
which will be installed and pinned to the installed version using
|
||||
SaltStack's `hold/unhold` capability.
|
||||
|
||||
When upgrading a version, the package will be temporarily unheld,
|
||||
upgraded and then held again.
|
||||
|
||||
In the RedHat family, helding packages depend on a yum plugin that you
|
||||
need to install. In order to do this, you can add it using this formula, adding
|
||||
|
|
|
@ -23,10 +23,14 @@ pkg_req_pkgs:
|
|||
{% if held_packages != {} %}
|
||||
held_pkgs:
|
||||
pkg.installed:
|
||||
{% if held_packages is mapping %}
|
||||
- pkgs:
|
||||
{% for p, v in held_packages.items() %}
|
||||
- {{ p }}: {{ v }}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
- pkgs: {{ held_packages }}
|
||||
{% endif %}
|
||||
- hold: true
|
||||
- update_holds: true
|
||||
- require:
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
packages:
|
||||
pkgs:
|
||||
# A dict of "package: version" pairs:
|
||||
held:
|
||||
alien: 8.95
|
||||
iotop: 0.6-2
|
||||
|
||||
# Alternativelly, held packages can also be specified as a list with
|
||||
# no versions. In this case, the package will be held in the installed
|
||||
# version.
|
||||
# held:
|
||||
# - alien
|
||||
# - iotop
|
||||
wanted:
|
||||
- git
|
||||
- less
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
packages:
|
||||
pkgs:
|
||||
held:
|
||||
alien: 8.95
|
||||
iotop: 0.6-2.el7
|
||||
- alien
|
||||
- iotop
|
||||
wanted:
|
||||
- git
|
||||
- less
|
||||
|
|
|
@ -11,8 +11,10 @@ case os[:name]
|
|||
when 'redhat', 'centos'
|
||||
os_packages = %w(yum-plugin-versionlock)
|
||||
held_packages = {
|
||||
'alien': '8.95',
|
||||
'iotop': '0.6-2.el7'
|
||||
# We use this test for held packages in a list,
|
||||
# with no version (current version).
|
||||
'alien': '',
|
||||
'iotop': ''
|
||||
}
|
||||
lock_file = '/etc/yum/pluginconf.d/versionlock.list'
|
||||
when 'fedora'
|
||||
|
|
Loading…
Add table
Reference in a new issue