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

noservices: true noservices: true
vendor_repo: vendor_repo:
- type: apt - 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 key_url: http://apt-mk.mirantis.com/public.gpg
components: salt components: salt
distribution: testing distribution: testing
image: <%=ENV['PLATFORM'] || 'trevorj/salty-whales:xenial'%> image: <%=ENV['PLATFORM'] || 'trevorj/salty-whales:xenial'%>
platform: ubuntu 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: suites:

- name: minion-default - name: minion-default
provisioner: provisioner:
pillars: pillars:
salt.sls: tests/pillar/minion_multi_master_failover.sls 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 # vim: ft=yaml sw=2 ts=2 sts=2 tw=125

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

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


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

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

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


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

Loading…
Cancel
Save