salt: Status pkg.removed fails on Ubuntu 14.04

Hi,

This issue is the same as/related to https://github.com/saltstack/salt/issues/9984 but it was closed.

Today I tried to remove package on Ubuntu 14.04 when it had been removed already, but it failed. This time the package is openjdk-7-jre. salt is Helium (2014.7.2) and this failed on 2015.2.0rc2 too.

SLS:

remove stock java:
  pkg:
    - removed
    - pkgs:
      - openjdk-7-jre

And the error output is :

[INFO    ] Running state [remove stock java] at time 03:17:28.331239
[INFO    ] Executing state pkg.removed for remove stock java
[INFO    ] Executing command ['apt-get', '-q', '-y', 'remove', 'openjdk-7-jre'] in directory '/root'
[TRACE   ] output: Reading package lists...
Building dependency tree...
Reading state information...
Package 'openjdk-7-jre' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 17 not upgraded.
[INFO    ] Executing command ['dpkg-query', '--showformat', '${Status} ${Package} ${Version} ${Architecture}\n', '-W'] in directory '/root'
[TRACE   ] stdout: install ok installed accountsservice 0.6.35-0ubuntu7.1 amd64
install ok installed acl 2.2.52-1 amd64
install ok installed acpid 1:2.0.21-1ubuntu2 amd64
install ok installed adduser 3.113+nmu3ubuntu3 all
...... [ no openjdk ] ......
install ok installed zlib1g-dev 1:1.2.8.dfsg-1ubuntu1 amd64
[ERROR   ] The following packages failed to remove: openjdk-7-jre.
[INFO    ] Completed state [remove stock java] at time 03:17:28.568236

ywliu

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

I don’t think solving this problem could be avoided based on the argument that the package is broken. It has been reported for four packages (lxc-docker, rsh-client, openjdk-7-jre and varnish) until now.

In the previous bug there’s a reference to the exact snippet of code that provoques the problem, when it adds the virtual packages as installed packages without checking first if the package is real or virtual.

If a parameter that tells saltstack to not remove the package if it’s virtual could be added to pkg.removed everything will be solved. Something like:

remove stock java:
  pkg.removed:
    - virtual: False
    - pkgs:
      - openjdk-7-jre