salt: pkg.installed succeeded but says it failed

python-pip has been installed after the execution of this state:

salt-ssh minion state.sls my_sls
minion:
----------
          ID: necessary_packages
    Function: pkg.installed
      Result: False
     Comment: The following packages failed to install/update: python-pip=7.1.2 42 targeted packages were already installed
     Started: 12:36:58.350875
    Duration: 12753.843 ms
     Changes:   
              ----------
              python-pip:
                  ----------
                  new:
                      7.1.2-1.0
                  old:
...

Finally running salt-ssh-2015.8.0 and salt-2015.8.0 installed via pip.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 36 (18 by maintainers)

Most upvoted comments

This is not a bug, this is expected behavior. Salt does not support using aliased package names, for the reasons described in this comment.

You will need to use the actual package name. For CentOS, that is vim-enhanced.

@adamehirsch The reason you are seeing that is because the package is a 32-bit package on a 64-bit OS, and Salt adds .arch (e.g. .i686) to the package name so that there are no collisions with potential 64-bit versions of the same package. This is what allows one to have the 64 and 32-bit versions of the same package installed, provided they do not conflict with one another. You would need to use fish.i686 in your example.

had the same issue, put a workaround in place by making the package name and version an exact match to the changes output.

In my case, changes output was:

'docker-ce': {'new': '18.03.1.ce-1.el7.centos', 'old': ''}, 

I updated the state to:

install_docker:
  pkg.installed:
    - name: docker-ce
    - version: 18.03.1.ce-1.el7.centos

@theunsa , I’m experiencing the same issue on the 2017.2 branch. One workaround that did the trick for me was to do e.g.

firefox:
  module.run:
    - name: pkg.install
    - m_name: firefox
    - version: latest

instead of

firefox:
  pkg.installed:
    - version: latest

All,

I just ran into this issue and found something interesting.

          ID: curator_package_dependencies
    Function: pkg.installed
        Name: python-pip
      Result: False
     Comment: The following packages failed to install/update: python-pip
     Started: 17:43:10.542141
    Duration: 40934.825 ms
     Changes:
              ----------
              python-setuptools:
                  ----------
                  new:
                      0.9.8-7.el7
                  old:
              python2-pip:
                  ----------
                  new:
                      8.1.2-5.el7
                  old:

Notice, that the package that I was trying to install was python-pip. In CentOS, that is referred to as python2-pip. Because it went ahead and found that out for me, it still installed…but Salt was looking for python-pip, and therefore marked it as a failure.

Once I changed my state to python2-pip, the EXACT name that is coming from the package management software, things went green:

          ID: curator_package_dependencies
    Function: pkg.installed
      Result: True
     Comment: All specified packages are already installed
     Started: 17:53:57.920742
    Duration: 536.19 ms
     Changes:

Is there an update for a possible fix of this issue? We keep running into it over and over again.

I’m running into the same thing with a specific piece of software I’m trying to install.

Assume the package is called michaelsoft-1.2.3-45.el7.x86_64.

michaelsoft:
  pkg_version: 1.2.3

If I try the following snippet, salt returns a message that the packages failed to install or update. Contrary to the salt output, the packages DO get installed.

Install packages:
  pkg.installed:
    - enablerepo: internal_repository
    - fromrepo: internal_repository
    - pkgs:
      - {{ michaelsoft.pkg }}: {{ michaelsoft.pkg_version }}
      - {{ michaelsoft.pkg }}-libs: {{ michaelsoft.pkg_version }}

Salt shows the correct output strictly because I put the -45.el7 portion of the package name on. The packages are installed just as above.

{% set osmajorrelease = salt['grains.get']('osmajorrelease') %}

Install packages:
  pkg.installed:
    - enablerepo: internal_repository
    - fromrepo: internal_repository
    - pkgs:
      - {{ michaelsoft.pkg }}: {{ michaelsoft.pkg_version }}-45.el{{ osmajorrelease }}
      - {{ michaelsoft.pkg }}-libs: {{ michaelsoft.pkg_version }}-45.el{{ osmajorrelease }}

It would be useful to have a flag such as ignore_release: True much like ignore_epoch: True that would allow someone to ignore -45.el7 or other release information.

Same here, error using the most basic example, installing vim to a Centos 7 minion:

thor:

          ID: vim
    Function: pkg.installed
      Result: False
     Comment: The following packages failed to install/update: vim
     Started: 23:40:47.181361
    Duration: 2657.922 ms
     Changes:

Summary for thor
Succeeded: 0
Failed:    1
Total states run:     1

On minion side: Package 2:vim-enhanced-7.4.160-1.el7.x86_64 already installed and latest version