Browse Source

salt.minion, salt.master switch to pkg.installed

Currently the CI job fails with module not found errror.
AttributeError: 'module' object has no attribute 'check_refresh

The reason is new version of salt tries to call
salt.utils.pkg.check_refresh which is not available in 2016.11.3 but is
available in 2016.11.6.
Reference:
1. https://github.com/saltstack/salt/blob/v2016.11.3/salt/states/pkg.py
2. https://github.com/saltstack/salt/blob/v2016.11.6/salt/states/pkg.py#L1819

The fix proposed here is to use pkg.installed instead of pkg.latest.
It's not a good idea to always update salt whenever the salt state is
run, this may introduce failures unknown to the user. There is a pipeline
to update packages which should be used for updating to latest.
pkg.latest generally isn't a good way to write idempotent formulas. See
official salt docs: "Generally it is better for the installed function
to be used, as latest will update the package whenever a new package is
available."

Change-Id: I8da5c36c1613e54768993080f2514afc920c49f8
pull/53/head
Sam Stoelinga 7 years ago
parent
commit
dfdb515795
3 changed files with 3 additions and 30 deletions
  1. +1
    -28
      .kitchen.yml
  2. +1
    -1
      salt/master/service.sls
  3. +1
    -1
      salt/minion/service.sls

+ 1
- 28
.kitchen.yml View File

@@ -17,7 +17,7 @@ provisioner:
noservices: true
vendor_repo:
- type: apt
url: http://apt-mk.mirantis.com/trusty
url: http://apt-mk.mirantis.com/xenial
key_url: http://apt-mk.mirantis.com/public.gpg
components: salt
distribution: testing
@@ -60,21 +60,7 @@ platforms:
image: <%=ENV['PLATFORM'] || 'trevorj/salty-whales:xenial'%>
platform: ubuntu

# - name: ubuntu-xenial
# driver_config:
# image: trevorj/salty-whales:xenial
# platform: ubuntu

# - name: debian-jessie
# driver_config:
# image: debian:jessie

# - name: debian-stretch
# driver_config:
# image: debian:stretch

suites:

- name: minion-default
provisioner:
pillars:
@@ -144,17 +130,4 @@ suites:
salt.sls: tests/pillar/minion_multi_master_failover.sls


# - name: minion-local
# provisioner:
# pillars:
# top.sls:
# base:
# "*":
# - common
# - minion_local_pillar
# - minion_local_reclass
# pillars-from-files:
# minion_local_pillar.sls: tests/pillar/minion_local_pillar.sls
# minion_local_reclass.sls: tests/pillar/minion_local_reclass.sls

# vim: ft=yaml sw=2 ts=2 sts=2 tw=125

+ 1
- 1
salt/master/service.sls View File

@@ -4,7 +4,7 @@
{%- if master.source.get('engine', 'pkg') == 'pkg' %}

salt_master_packages:
pkg.latest:
pkg.installed:
- names: {{ master.pkgs }}
{%- if master.source.version is defined %}
- version: {{ master.source.version }}

+ 1
- 1
salt/minion/service.sls View File

@@ -4,7 +4,7 @@
{%- if minion.source.get('engine', 'pkg') == 'pkg' %}

salt_minion_packages:
pkg.latest:
pkg.installed:
- names: {{ minion.pkgs }}
{%- if minion.source.version is defined %}
- version: {{ minion.source.version }}

Loading…
Cancel
Save