salt icon indicating copy to clipboard operation
salt copied to clipboard

FreeBSD pkg latest issue

Open abednarik opened this issue 8 years ago • 2 comments

Description of Issue/Question

We have our custom FreeBSD Repository, where we store updated version of some packages. We just update salt to 2017.7.4 and we found and issue while using pkg.latest

This is what salt executes, to get package version, in this case for Nginx. There are a few messages with DEBUG, those are some lines added by me to get more info while debugging the issue

[DEBUG   ] DEBUG - Command: ['pkg', 'search', '-S', 'name', '-Q', 'version', '-e', '-q', 'nginx']
[INFO    ] Executing command ['pkg', 'search', '-S', 'name', '-Q', 'version', '-e', '-q', 'nginx'] in directory '/home/abednarik'
[DEBUG   ] DEBUG - Package: nginx, Version: 1.12.2_3,2
[DEBUG   ] Could not LazyLoad pkg.normalize_name: 'pkg.normalize_name' is not available.
[INFO    ] Executing command ['pkg', 'install', '-r', 'Perceptyx', '-y', 'nginx'] in directory '/home/abednarik'
[INFO    ] Executing command ['pkg', 'info', '-ao'] in directory '/home/abednarik'
[ERROR   ] Made the following changes:
'nginx' changed from 'absent' to '1.12.2_10,2'

As you can see, the search command returns version 1.12.2_3,2 while 1.12.2_10,2 is the latest one from our repos and is the one installed.

State fails, I think here because installed version is not the same as the one salt stores as the latest one.

----------
          ID: nginx
    Function: pkg.latest
      Result: False
     Comment: The following packages failed to update: nginx
     Started: 12:25:14.197295
    Duration: 1451.617 ms
     Changes:
              ----------
              nginx:
                  ----------
                  new:
                      1.12.2_10,2
                  old:

If I change reverse=False here things work as expected.

Setup

This is the state

nginx:
  pkg.latest:
    - name: {{ nginx_pkg }}
{%- if grains['os'] == 'FreeBSD' %}
    - require:
      - cmd: repository_update
    - fromrepo: Company
{% endif %}
  service.running:
    - enable: True
    - watch:
      - file: {{ nginx_config_dir }}
    - require:
      - pkg: {{ nginx_pkg }}
      - file: /var/log/nginx

Steps to Reproduce Issue

Well you need to have your custom FreeBSD repositories, with an updated version of Nginx or any other package and use pkg.latest

Versions Report

Salt Version:
           Salt: 2017.7.4

Dependency Versions:
           cffi: 1.7.0
       cherrypy: Not Installed
       dateutil: 2.6.1
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.10
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.7
   mysql-python: Not Installed
      pycparser: 2.10
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.14 (default, Mar 10 2018, 01:12:12)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 16.0.3
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.5.2
            ZMQ: 4.2.2

System Versions:
           dist:
         locale: US-ASCII
        machine: amd64
        release: 10.3-RELEASE-p24
         system: FreeBSD
        version: Not Installed

abednarik avatar Mar 20 '18 20:03 abednarik

thanks for the PR! will close issuer here but please let me know if you need to re-open. we will keep discussion in pr

Ch3LL avatar Mar 21 '18 15:03 Ch3LL

Sure, thanks.

abednarik avatar Mar 21 '18 15:03 abednarik