salt icon indicating copy to clipboard operation
salt copied to clipboard

[BUG] zypperpkg.install with version + comparison operator is not working

Open cmonty14 opened this issue 4 years ago • 3 comments

Description I want to install a package using a combination of a comparison operator (<, >, <=, >=, =) and a version number (ex. '>1.2.3-4'). This is documented here.

One can see in the debug output that this zypper-command is generated. zypper --non-interactive --no-refresh install --auto-agree-with-licenses --name yast2-saptune saptune<3.0

However, package saptune<3.0 is not exisiting.

Setup (Please provide relevant configs and/or SLS files (be sure to remove sensitive info. There is no general set-up of Salt.)

Please be as specific as possible and give set-up details.

  • [x] on-prem machine
  • [ ] VM (Virtualbox, KVM, etc. please specify)
  • [ ] VM running on a cloud service, please be explicit and add details
  • [ ] container (Kubernetes, Docker, containerd, etc. please specify)
  • [ ] or a combination, please be explicit
  • [ ] jails if it is FreeBSD

Steps to Reproduce the behavior Execute command salt-call -l debug --local pkg.install pkgs='["yast2-saptune", {"saptune": "<3.0"}]' Here's the debut output:

~ # salt-call -l debug --local pkg.install pkgs='["yast2-saptune", {"saptune": "<3.0"}]'
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG   ] Including configuration from '/etc/salt/minion.d/susemanager.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/susemanager.conf
[DEBUG   ] Using cached minion ID from /etc/salt/minion_id: ld3232.wdf.sap.corp
[DEBUG   ] Configuration file path: /etc/salt/minion
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[DEBUG   ] Grains refresh requested. Refreshing grains.
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG   ] Including configuration from '/etc/salt/minion.d/susemanager.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/susemanager.conf
[DEBUG   ] Checking if minion is running in the public cloud
[DEBUG   ] Error while parsing IPv4 address: ::1
[DEBUG   ] Expected 4 octets in '::1'
[DEBUG   ] Error while parsing IPv4 address: fe80::98be:94ff:fef7:ba37
[DEBUG   ] Expected 4 octets in 'fe80::98be:94ff:fef7:ba37'
[DEBUG   ] Error while parsing IPv4 address: fe80::42f2:e9ff:fe1f:af90
[DEBUG   ] Expected 4 octets in 'fe80::42f2:e9ff:fe1f:af90'
[DEBUG   ] Trying lscpu to get CPU socket count
[DEBUG   ] LazyLoaded zfs.is_supported
[DEBUG   ] Determining pillar cache
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] LazyLoaded pkg.install
[DEBUG   ] LazyLoaded direct_call.execute
[DEBUG   ] targeting package: yast2-saptune
[DEBUG   ] targeting package: saptune<3.0
[DEBUG   ] LazyLoaded cmd.run
[INFO    ] Executing command rpm in directory '/root'
[DEBUG   ] LazyLoaded config.get
[DEBUG   ] Calling Zypper: systemd-run --scope zypper --non-interactive --no-refresh install --auto-agree-with-licenses --name yast2-saptune saptune<3.0
[INFO    ] Executing command systemd-run in directory '/root'
[INFO    ] Executing command rpm in directory '/root'
[DEBUG   ] LazyLoaded nested.output
local:
    ----------
    yast2-saptune:
        ----------
        new:
            1.3-3.3.1
        old:

Expected behavior Packages with a combination of version and comparison operator should be installed correctly.

Screenshots If applicable, add screenshots to help explain your problem.

Versions Report

salt-call --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
          Salt: 3002.2

Dependency Versions:
          cffi: 1.13.2
      cherrypy: Not Installed
      dateutil: Not Installed
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 2.10.1
       libgit2: Not Installed
      M2Crypto: 0.35.2
          Mako: Not Installed
       msgpack: 0.5.6
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.17
      pycrypto: Not Installed
  pycryptodome: Not Installed
        pygit2: Not Installed
        Python: 3.6.13 (default, Mar 10 2021, 18:30:35) [GCC]
  python-gnupg: Not Installed
        PyYAML: 5.3.1
         PyZMQ: 17.1.2
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.2.3

System Versions:
          dist: sles 15.2
        locale: UTF-8
       machine: x86_64
       release: 5.3.18-24.86-default
        system: Linux
       version: SLES 15.2

Additional context The relevant package to be installed is saptune=2.0.3-8.11.1

~ # zypper info saptune
Loading repository data...
Reading installed packages...


Information for package saptune:
--------------------------------
Repository     : cl-sle15-sp2-sap-sec-sec-SLE-Module-SAP-Applications15-SP2-Pool for x86_64
Name           : saptune
Version        : 2.0.3-8.11.1
Arch           : x86_64
Vendor         : SUSE LLC <https://www.suse.com/>
Support Level  : Level 3
Installed Size : 4.9 MiB
Installed      : Yes
Status         : up-to-date
Source package : saptune-2.0.3-8.11.1.src
Summary        : Comprehensive system tuning management for SAP solutions
Description    :
    The utility adjusts system parameters such as kernel parameters and resource
    limits to allow running various SAP solutions at satisfactory performance.
    The utility can be used in place of sapconf.

cmonty14 avatar Dec 06 '21 13:12 cmonty14

@meaksh FYI.

garethgreenaway avatar Jun 21 '22 17:06 garethgreenaway

According to the logs, the actual Zypper command looks correct, passing both packages with the correct paramenters:

[DEBUG   ] Calling Zypper: systemd-run --scope zypper --non-interactive --no-refresh install --auto-agree-with-licenses --name yast2-saptune saptune<3.0

Actually, looking at the information you pasted, It looks like the package saptune is already installed on the system:

Installed      : Yes
Status         : up-to-date
Source package : saptune-2.0.3-8.11.1.src

That would explain why you don't get it installed with your salt-call execution.

I did test this locally and it works as expected for me. Both packages are successfully installed:

d3b54444a6bc:/ # salt-call -l debug --local pkg.install pkgs='["yast2-saptune", {"saptune": "<3.0"}]'
[DEBUG   ] Missing configuration file: /etc/salt/minion
[DEBUG   ] Using cached minion ID from /etc/salt/minion_id: d3b54444a6bc
[DEBUG   ] Configuration file path: /etc/salt/minion
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[DEBUG   ] Grains refresh requested. Refreshing grains.
[DEBUG   ] Missing configuration file: /etc/salt/minion
[DEBUG   ] Error while parsing IPv4 address: ::1
[DEBUG   ] Expected 4 octets in '::1'
[DEBUG   ] Error while parsing IPv4 address: fe80::1857:7fff:feaa:80bc
[DEBUG   ] Expected 4 octets in 'fe80::1857:7fff:feaa:80bc'
[DEBUG   ] Unable to resolve address fe80::1857:7fff:feaa:80bc: [Errno 1] Unknown host
[DEBUG   ] Elapsed time getting FQDNs: 0.111765146255 seconds
[DEBUG   ] Error while parsing IPv4 address: ::1
[DEBUG   ] Expected 4 octets in '::1'
[DEBUG   ] Error while parsing IPv4 address: fe80::1857:7fff:feaa:80bc
[DEBUG   ] Expected 4 octets in 'fe80::1857:7fff:feaa:80bc'
[DEBUG   ] Could not determine init system from command line: (/bin/bash)
[DEBUG   ] The `lspci` binary is not available on the system. GPU grains will not be available.
[DEBUG   ] LazyLoaded zfs.is_supported
[DEBUG   ] Determining pillar cache
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] LazyLoaded pkg.install
[DEBUG   ] LazyLoaded direct_call.execute
[DEBUG   ] targeting package: yast2-saptune
[DEBUG   ] targeting package: saptune<3.0
[DEBUG   ] LazyLoaded cmd.run
[INFO    ] Executing command rpm in directory '/root'
[DEBUG   ] Calling Zypper: zypper --non-interactive --no-refresh install --auto-agree-with-licenses --name yast2-saptune saptune<3.0
[INFO    ] Executing command zypper in directory '/root'
[INFO    ] Executing command rpm in directory '/root'
[DEBUG   ] LazyLoaded nested.output
local:
    ----------
[...]
    saptune:
        ----------
        new:
            2.0.3-3.11.1
        old:
[...]
    yast2:
        ----------
        new:
            3.2.52-7.3.3
        old:
    yast2-saptune:
        ----------
        new:
            1.4-3.7.1
        old:
[...]

@cmonty14 could you please double check this is correct? Thanks!

meaksh avatar Jun 22 '22 08:06 meaksh

@cmonty14 Just making sure you saw the above comments from @meaksh

garethgreenaway avatar Aug 09 '22 17:08 garethgreenaway

Comments of @meaksh are correct. Issue can be closed.

cmonty14 avatar Aug 11 '22 10:08 cmonty14