salt icon indicating copy to clipboard operation
salt copied to clipboard

ignore_epoch ignored in nitrogen release candidate

Open Orlando-Richards opened this issue 9 years ago • 6 comments

Description of Issue/Question

Setup

Create an SLS file to lock a package with a non-zero epoch to a version without specifying the epoch, but with igore_epoch=true:

# yum info vim-common
Installed Packages
Name        : vim-common
Arch        : x86_64
Epoch       : 2
Version     : 7.4.160
Release     : 1.el7_3.1
Size        : 21 M
Repo        : installed
<snip>

State to install this version:

test:
  pkg.installed:
    - ignore_epoch: True
    - pkgs:
      - vim-common: 7.4.160-1.el7_3.1

Steps to Reproduce Issue

Issue present on CentOS7.3

  1. install vim-common
  2. create state to install vim-common at the current version (see above)
  3. run state:
# salt-call state.apply test --log-level=error
local:
----------
          ID: test
    Function: pkg.installed
      Result: None
     Comment: The following packages would be installed/updated: vim-common=7.4.160-1.el7_3.1
     Started: 23:11:36.626566
    Duration: 1175.423 ms
     Changes:

Summary for local
------------
Succeeded: 1 (unchanged=1)
Failed:    0
------------
Total states run:     1
Total run time:   1.175 s

Note an entry from the debug level log:

[DEBUG   ] Could not LazyLoad pkg.version_clean: 'pkg.version_clean' is not available.
[DEBUG   ] Current version (['2:7.4.160-1.el7_3.1']) did not match desired version specification (7.4.160-1.el7_3.1), adding to installation targets
[INFO    ] The following packages would be installed/updated: vim-common=7.4.160-1.el7_3.1

Versions Report

Salt Version:
           Salt: 2017.7.0rc1

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.6.0
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.7.2
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: 1.0.6
   msgpack-pure: Not Installed
 msgpack-python: 0.4.8
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: 3.4.3
         pygit2: Not Installed
         Python: 2.7.5 (default, Nov  6 2016, 00:28:07)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.3.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4

System Versions:
           dist: centos 7.3.1611 Core
         locale: UTF-8
        machine: x86_64
        release: 3.10.0-514.21.2.el7.x86_64
         system: Linux
        version: CentOS Linux 7.3.1611 Core

Note that this issue is not present in 2016.11.5-3, where ignore_epoch behaves as expected.

Orlando-Richards avatar Jul 13 '17 22:07 Orlando-Richards

Specifying the epoch in the version makes it work okay:

test:
  pkg.installed:
    - pkgs:
      - vim-common: 2:7.4.160-1.el7_3.1

Results in no changes, and:

[INFO    ] All specified packages are already installed and are at the desired version

Orlando-Richards avatar Jul 13 '17 22:07 Orlando-Richards

Also - specifying the epoch as a wildcard also works:

test:
  pkg.installed:
    - pkgs:
      - vim-common: '*:7.4.160-1.el7_3.1'

Orlando-Richards avatar Jul 13 '17 22:07 Orlando-Richards

Is the ignore_epoch function needed now with wildcard support now in place? It could be that this is now "just" a documentation issue?

Orlando-Richards avatar Jul 14 '17 16:07 Orlando-Richards

No, I think that ignore_epoch should still work. I'll look at this.

terminalmage avatar Jul 14 '17 21:07 terminalmage

We're seeing this fail too. In our case this causes a recursion error when trying to install a kernel-devel package with ignore_epoch: True.

kernel-devel:
  pkg.installed:
    - name: kernel-devel
    - version: '{{ grains['kernelrelease'].rsplit('.', 1)[0] }}'
    - ignore_epoch: True

RuntimeError: maximum recursion depth exceeded

As per @OrlandoArcapix comment, using a wildcard on the epoch works fine.

afletch avatar Jul 20 '17 09:07 afletch

This issue has the same root cause as #42774, and has been fixed by https://github.com/saltstack/salt/pull/42808.

terminalmage avatar Aug 08 '17 19:08 terminalmage