Skip to content

pkg.installed fails when version is used #33013

Closed

Description

@justinta

Description of Issue/Question

When passing in the version option into pkg.installed, the package will get installed, but the state will fail.

Setup

I've done this on both Arch linux and CentOS 5 with the same results.

CentOS 5 state:

/srv/salt/python-devel.sls
python-dev:
  pkg.installed:
    - name: python26-devel
    - version: 0:2.6.8-3.el5

Arch Linux state:

/srv/salt/nginx.sls
nginx-install:
  pkg.installed:
    - name: nginx
    - version: 1.10.0

Steps to Reproduce Issue

This can be run via `salt '*' state.sls nginx' or with salt-call

salt-call --local state.sls nginx
[INFO    ] Determining pillar cache
[INFO    ] Determining pillar cache
[INFO    ] Loading fresh modules for state activity
[INFO    ] Fetching file from saltenv 'base', ** done ** u'nginx.sls'
[INFO    ] Executing command 'npm --version' in directory '/root'
[INFO    ] Running state [nginx] at time 15:31:49.381700
[INFO    ] Executing state pkg.installed for nginx
[INFO    ] Executing command 'pacman -Q' in directory '/root'
[INFO    ] Executing command 'pacman -S "--noprogressbar" "--noconfirm" "--needed" "-y" "nginx=1.10.0"' in directory '/root'
[INFO    ] Executing command 'pacman -Q' in directory '/root'
[ERROR   ] Made the following changes:
'nginx' changed from 'absent' to '1.10.0-2'

[INFO    ] Loading fresh modules for state activity
[INFO    ] Completed state [nginx] at time 15:31:53.835534
local:
----------
          ID: nginx-install
    Function: pkg.installed
        Name: nginx
      Result: False
     Comment: The following packages failed to install/update: nginx=1.10.0
     Started: 15:31:49.381700
    Duration: 4453.834 ms
     Changes:
              ----------
              nginx:
                  ----------
                  new:
                      1.10.0-2
                  old:

Summary for local
------------
Succeeded: 0 (changed=1)
Failed:    1
------------
Total states run:     1

Versions Report

Cent OS 5

Salt Version:
           Salt: 2015.8.8.2

Dependency Versions:
         Jinja2: 2.5.5
       M2Crypto: 0.21.1
           Mako: Not Installed
         PyYAML: 3.08
          PyZMQ: 14.5.0
         Python: 2.6.8 (unknown, Mar 15 2016, 21:23:59)
           RAET: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
        libgit2: Not Installed
        libnacl: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.5
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
   python-gnupg: Not Installed
          smmap: Not Installed
        timelib: Not Installed

System Versions:
           dist: redhat 5.6 Final
        machine: x86_64
        release: 4.5.0-x86_64-linode65
         system: CentOS 5.6 Final

Arch

Salt Version:
           Salt: 2015.8.8.2

Dependency Versions:
         Jinja2: 2.8
       M2Crypto: 0.24.0
           Mako: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.2.0
         Python: 2.7.11 (default, Mar 31 2016, 06:18:34)
           RAET: 0.6.5
        Tornado: 4.3
            ZMQ: 4.1.4
           cffi: 1.6.0
       cherrypy: 3.8.0
       dateutil: 2.4.2
          gitdb: 0.6.4
      gitpython: 1.0.1
          ioflo: 1.5.0
        libgit2: Not Installed
        libnacl: 1.4.4
   msgpack-pure: Not Installed
 msgpack-python: 0.4.7
   mysql-python: 1.2.5
      pycparser: 2.14
       pycrypto: 2.6.1
         pygit2: Not Installed
   python-gnupg: 0.3.7
          smmap: 0.9.0
        timelib: 0.2.4

System Versions:
           dist:
        machine: x86_64
        release: 4.1.3

Activity

  1. added this to the Approved milestone on May 3, 2016
  2. added
    bug
    severity-medium
    Core
    P2
    on May 3, 2016
  3. added
    Confirmed
    Platform
    and removed
    Core
    on May 3, 2016
  4. added
    severity-high
    and removed
    severity-medium
    on May 5, 2016
  5. justinta commented on May 5, 2016

    @justinta
    Author

    @meggiebot This may be a blocker... I'd like to have someone else look at it.

  6. 2 remaining items

  7. removed this from the Approved milestone on May 5, 2016
  8. terminalmage commented on May 10, 2016

    @terminalmage
    Contributor

    I don't see how this is a bug. Presumably the nginx SLS file specifies a version of 1.10.0, but the installed version is 1.10.0-2, which is not the same.

  9. terminalmage commented on May 10, 2016

    @terminalmage
    Contributor

    Seems like incorrectly-written SLS to me.

  10. thatch45 commented on May 10, 2016

    @thatch45
    Contributor

    I agree with @terminalmage, this state looks to be running correctly

  11. added a commit that references this issue on May 10, 2016
    b14f7c6
  12. modified the milestones: C 10, B -3 on May 10, 2016
  13. terminalmage commented on May 10, 2016

    @terminalmage
    Contributor

    Fixed in #33146.

  14. added a commit that references this issue on May 10, 2016
    c5b0cb4
  15. terminalmage commented on May 11, 2016

    @terminalmage
    Contributor

    As a bit more background, since it wasn't described in the initial post, although this issue as reported was really just a matter of badly-formatted SLS, on subsequent state runs after the first one, the state would return True, when it should have failed like it did the first time. This was fixed in #33146, which has been merged.

  16. added a commit that references this issue on May 12, 2016
    457d9dd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ConfirmedP2PlatformState-ModuleZRELEASED - Boronbugseverity-criticalseverity-high

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions