uyuni-project / contrib

Collection of tools that are are not (yet!) officially part of the Uyuni product
8 stars 4 forks source link

group_system_update.py: "salt.exceptions.SaltInvocationError: You are passing a list of packages that contains duplicated packages names" #28

Open heiwu opened 1 month ago

heiwu commented 1 month ago

This is our Script file:

# md5sum /opt/uyuni-tools/group_system_update.py
249044cdeaec3b09f56a1132932b347b  /opt/uyuni-tools/group_system_update.py

Head incl. Version:

# head /opt/uyuni-tools/group_system_update.py
#!/usr/bin/env python3
#
# group_system_update
#
# (c) 2018 SUSE Linux GmbH, Germany.
# GNU Public License. No warranty. No Support
# For question/suggestions/bugs mail: michael.brookhuis@suse.com
#
# Version: 2020-06-29
#
# Created by: SUSE Michael Brookhuis
#
# This script will perform the following actions:
# - will call system_update for all systems in the given systemgroup.
# - if the config should also be deployed, the option --applyconfig should be given.
#
# Releases:
# 2019-11-02 M.Brookhuis - Initial release
# 2020-01-15 M.Brookhuis - Added update script option.
# 2020-06-29 M.Brookhuis - Version 2.
#                        - changed logging
#                        - moved api calls to smtools.py
#

called using crontab: 34 05 * * 2 /opt/uyuni-tools/group_system_update.py -g 'Autopatch'; /opt/uyuni-tools/group_system_update.py --noreboot -g 'livepatch'

We are getting this error (only when using group_system_update.py. zypper up works perfectly fine):


The error messages is:
saltutil_|-sync_states_|-sync_states_|-sync_states:
    name: sync_states
    changes: {
        }
    result: true
    comment: No updates to sync
    __sls__: util.syncstates
    __run_num__: 0.0
    start_time: '05:35:54.281794'
    duration: 959.946
    __id__: sync_states
pkg_|-mgr_absent_ca_package_|-rhn-org-trusted-ssl-cert_|-removed:
    name: rhn-org-trusted-ssl-cert
    changes: {
        }
    result: true
    comment: All specified packages are already absent
    __sls__: certs
    __run_num__: 1.0
    start_time: '05:35:56.024317'
    duration: 9.028
    __id__: mgr_absent_ca_package
file_|-mgr_ca_cert_|-/etc/pki/trust/anchors/RHN-ORG-TRUSTED-SSL-CERT_|-managed:
    changes: {
        }
    comment: File /etc/pki/trust/anchors/RHN-ORG-TRUSTED-SSL-CERT is in the correct state
    name: /etc/pki/trust/anchors/RHN-ORG-TRUSTED-SSL-CERT
    result: true
    __sls__: certs
    __run_num__: 2.0
    start_time: '05:35:56.035508'
    duration: 28.295
    __id__: mgr_ca_cert
cmd_|-update-ca-certificates_|-/usr/sbin/update-ca-certificates_|-run:
    changes: {
        }
    result: true
    duration: 0.004
    start_time: '05:35:56.065040'
    comment: State was not run because none of the onchanges reqs changed
    __state_ran__: false
    __run_num__: 3.0
    __sls__: certs
    __id__: update-ca-certificates
    name: /usr/sbin/update-ca-certificates
file_|-mgr_proxy_ca_cert_symlink_|-/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT_|-symlink:
    result: true
    name: /usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT
    changes: {
        }
    comment: onlyif condition is false
    __sls__: certs
    __id__: mgr_proxy_ca_cert_symlink
    skip_watch: true
    __run_num__: 4.0
    start_time: '05:35:56.065120'
    duration: 407.175
file_|-mgr_deploy_tools_uyuni_key_|-/etc/pki/rpm-gpg/uyuni-tools-gpg-pubkey-0d20833e.key_|-managed:
    changes: {
        }
    comment: File /etc/pki/rpm-gpg/uyuni-tools-gpg-pubkey-0d20833e.key is in the correct state
    name: /etc/pki/rpm-gpg/uyuni-tools-gpg-pubkey-0d20833e.key
    result: true
    __sls__: channels.gpg-keys
    __run_num__: 5.0
    start_time: '05:35:56.472437'
    duration: 27.4
    __id__: mgr_deploy_tools_uyuni_key
file_|-mgr_deploy_suse_addon_key_|-/etc/pki/rpm-gpg/suse-addon-97a636db0bad8ecc.key_|-managed:
    changes: {
        }
    comment: File /etc/pki/rpm-gpg/suse-addon-97a636db0bad8ecc.key is in the correct state
    name: /etc/pki/rpm-gpg/suse-addon-97a636db0bad8ecc.key
    result: true
    __sls__: channels.gpg-keys
    __run_num__: 6.0
    start_time: '05:35:56.500016'
    duration: 36.007
    __id__: mgr_deploy_suse_addon_key
mgrcompat_|-https_// suma.our.domain/pub/icinga.key_|-pkg.add_repo_key_|-module_run:
    name: pkg.add_repo_key
    changes:
        ret: true
    comment: Module function pkg.add_repo_key executed
    result: true
    __sls__: channels.gpg-keys
    __run_num__: 7.0
    start_time: '05:35:56.536166'
    duration: 34.289
    __id__: https_// suma.our.domain/pub/icinga.key
file_|-mgrchannels_repo_|-/etc/zypp/repos.d/susemanager:channels.repo_|-managed:
    changes: {
        }
    comment: File /etc/zypp/repos.d/susemanager:channels.repo is in the correct state
    name: /etc/zypp/repos.d/susemanager:channels.repo
    result: true
    __sls__: channels
    __run_num__: 8.0
    start_time: '05:35:56.570660'
    duration: 95.63
    __id__: mgrchannels_repo
product_|-mgrchannels_install_products_|-mgrchannels_install_products_|-all_installed:
    name: mgrchannels_install_products
    changes: {
        }
    result: true
    comment: All subscribed products are already installed
    __sls__: channels
    __run_num__: 9.0
    start_time: '05:35:56.666761'
    duration: 854.682
    __id__: mgrchannels_install_products
pkg_|-mgrchannels_inst_suse_build_key_|-suse-build-key_|-installed:
    name: suse-build-key
    changes: {
        }
    result: true
    comment: All specified packages are already installed
    __sls__: channels
    __run_num__: 10.0
    start_time: '05:35:57.522002'
    duration: 5022.48
    __id__: mgrchannels_inst_suse_build_key
pkg_|-pkg_installed_|-pkg_installed_|-installed:
    result: false
    name: pkg_installed
    changes: {
        }
    comment: |
        An exception occurred in this state: Traceback (most recent call last):
          File "/usr/lib/venv-salt-minion/lib64/python3.10/site-packages/salt/state.py", line 2401, in call
            ret = self.states[cdata["full"]](
          File "/usr/lib/venv-salt-minion/lib64/python3.10/site-packages/salt/loader/lazy.py", line 149, in __call__
            return self.loader.run(run_func, *args, **kwargs)
          File "/usr/lib/venv-salt-minion/lib64/python3.10/site-packages/salt/loader/lazy.py", line 1234, in run
            return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
          File "/usr/lib/venv-salt-minion/lib64/python3.10/site-packages/salt/loader/lazy.py", line 1249, in _run_as
            return _func_or_method(*args, **kwargs)
          File "/usr/lib/venv-salt-minion/lib64/python3.10/site-packages/salt/loader/lazy.py", line 1282, in wrapper
            return f(*args, **kwargs)
          File "/usr/lib/venv-salt-minion/lib/python3.10/site-packages/salt/states/pkg.py", line 1703, in installed
            result = _find_install_targets(
          File "/usr/lib/venv-salt-minion/lib/python3.10/site-packages/salt/states/pkg.py", line 584, in _find_install_targets
            desired = _repack_pkgs(pkgs, normalize=normalize)
          File "/usr/lib/venv-salt-minion/lib64/python3.10/site-packages/salt/modules/pkg_resource.py", line 38, in _repack_pkgs
            raise SaltInvocationError(
        salt.exceptions.SaltInvocationError: You are passing a list of packages that contains duplicated packages names: [{'libopenssl1_1.x86_64': '1.1.1l-150500.17.31.1'}, {'postgresql-server.noarch': '16-150500.10.6.1'}, {'postgresql.noarch': '16-150500.10.6.1'}, {'postgresql-contrib.noarch': '16-150500.10.6.1'}, {'libgcc_s1.x86_64': '13.3.0+git8781-150000.1.12.1'}, {'openssl-1_1.x86_64': '1.1.1l-150500.17.31.1'}, {'postgresql.noarch': '16-150500.10.6.1'}, {'postgresql-server.noarch': '16-150500.10.6.1'}, {'apache2-utils.x86_64': '2.4.51-150400.6.17.1'}, {'postgresql-contrib.noarch': '16-150500.10.6.1'}, {'libstdc++6.x86_64': '13.3.0+git8781-150000.1.12.1'}]. This cannot be processed. In case you are targeting different versions of the same package, please target them individually
    __sls__: packages.pkginstall
    __run_num__: 11.0
    start_time: '05:36:02.544876'
    duration: 5180.852
    __id__: pkg_installed

Latest version (uyuni-project/contrib/blob/main/uyuni-tools/group_system_update.py) in this repo seems to differ. I'll check and report if issue still exists.

heiwu commented 1 month ago

nope, issue still persists with latest uyuni tools version. What shall we do?

    result: false
    name: pkg_installed
    changes: {
        }
    comment: |
        An exception occurred in this state: Traceback (most recent call last):
          File "/usr/lib/venv-salt-minion/lib64/python3.10/site-packages/salt/state.py", line 2401, in call
            ret = self.states[cdata["full"]](
          File "/usr/lib/venv-salt-minion/lib64/python3.10/site-packages/salt/loader/lazy.py", line 149, in __call__
            return self.loader.run(run_func, *args, **kwargs)
          File "/usr/lib/venv-salt-minion/lib64/python3.10/site-packages/salt/loader/lazy.py", line 1234, in run
            return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
          File "/usr/lib/venv-salt-minion/lib64/python3.10/site-packages/salt/loader/lazy.py", line 1249, in _run_as
            return _func_or_method(*args, **kwargs)
          File "/usr/lib/venv-salt-minion/lib64/python3.10/site-packages/salt/loader/lazy.py", line 1282, in wrapper
            return f(*args, **kwargs)
          File "/usr/lib/venv-salt-minion/lib/python3.10/site-packages/salt/states/pkg.py", line 1703, in installed
            result = _find_install_targets(
          File "/usr/lib/venv-salt-minion/lib/python3.10/site-packages/salt/states/pkg.py", line 584, in _find_install_targets
            desired = _repack_pkgs(pkgs, normalize=normalize)
          File "/usr/lib/venv-salt-minion/lib64/python3.10/site-packages/salt/modules/pkg_resource.py", line 38, in _repack_pkgs
            raise SaltInvocationError(
        salt.exceptions.SaltInvocationError: You are passing a list of packages that contains duplicated packages names: [{'kernel-default-devel.x86_64': '5.14.21-150500.55.68.1'}, {'kernel-devel.noarch': '5.14.21-150500.55.68.1'}, {'kernel-default.x86_64': '5.14.21-150500.55.68.1'}, {'kernel-devel.noarch': '5.14.21-150500.55.68.1'}, {'kernel-devel.noarch': '5.14.21-150500.55.68.1'}, {'kernel-default-devel.x86_64': '5.14.21-150500.55.68.1'}, {'kernel-devel.noarch': '5.14.21-150500.55.68.1'}, {'kernel-default.x86_64': '5.14.21-150500.55.68.1'}]. This cannot be processed. In case you are targeting different versions of the same package, please target them individually
    __sls__: packages.pkginstall
    __run_num__: 11.0
    start_time: '05:36:50.948466'
    duration: 4580.686
    __id__: pkg_installed

On this system, 3 latest kernel versions are installed:

# zypper search -is kernel-default
Loading repository data...
Reading installed packages...

S  | Name                 | Type    | Version                | Arch   | Repository
---+----------------------+---------+------------------------+--------+----------------------------------------------------------------------
i+ | kernel-default       | package | 5.14.21-150500.55.68.1 | x86_64 | sles15sp5-default-prod-SLE-Module-Basesystem15-SP5-Updates for x86_64
i+ | kernel-default       | package | 5.14.21-150500.55.65.1 | x86_64 | sles15sp5-default-prod-SLE-Module-Basesystem15-SP5-Updates for x86_64
i+ | kernel-default       | package | 5.14.21-150500.55.62.2 | x86_64 | sles15sp5-default-prod-SLE-Module-Basesystem15-SP5-Updates for x86_64
i  | kernel-default-devel | package | 5.14.21-150500.55.68.1 | x86_64 | sles15sp5-default-prod-SLE-Module-Basesystem15-SP5-Updates for x86_64
i  | kernel-default-devel | package | 5.14.21-150500.55.65.1 | x86_64 | sles15sp5-default-prod-SLE-Module-Basesystem15-SP5-Updates for x86_64
i  | kernel-default-devel | package | 5.14.21-150500.55.62.2 | x86_64 | sles15sp5-default-prod-SLE-Module-Basesystem15-SP5-Updates for x86_64
heiwu commented 1 month ago

Any Feedback/Help is appreciated! This issue still persists on multiple systems running sles15sp5 and sles4sap15sp3.

rjmateus commented 1 month ago

Did you upgrade to uyuni version 2024.07 already? We made some changes in this area that should solve the issue

heiwu commented 1 month ago

Thanks for the hint! We are using SUSE Manager release 4.3.13 If those changes really could help i hope they make it into SUMA soon :)