saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
14.17k stars 5.48k forks source link

[BUG] pkg.group_installed says group is partially installed and will be updated when test=true #64634

Open ysagon opened 1 year ago

ysagon commented 1 year ago

Description Running salt state.sls with test=true indicates there is a change to be applied when a package is included in pkg.group_installed.

Setup Example sls:

pkgs_group_desktop_environment:
    pkg.group_installed:
        - name: xfce-desktop
        - skip:
            - xfce4-power-manager
        - include:
            -  pinentry-gtk #conditional package

Steps to Reproduce the behavior

salt-call --state-verbose=false --state-output=changes state.sls yann.test test=true
local:
----------
          ID: pkgs_group_desktop_environment
    Function: pkg.group_installed
        Name: Xfce
      Result: None
     Comment: Group 'Xfce' is partially installed and will be updated
     Started: 17:02:36.844530
    Duration: 4017.86 ms
     Changes:

Summary for local
------------
Succeeded: 1 (unchanged=1)
Failed:    0
------------
Total states run:     1
Total run time:   4.018 s

And nothing applied when running without test=true

salt-call --state-verbose=false --state-output=changes state.sls yann.test saltenv=base pillarenv=base
local:

Summary for local
------------
Succeeded: 1
Failed:    0
------------
Total states run:     1
Total run time:  12.193 s

Expected behavior No unchanged state when running with test=true

Versions Report

salt --versions-report ```yaml Salt Version: Salt: 3006.1 Python Version: Python: 3.10.11 (main, May 5 2023, 02:31:54) [GCC 11.2.0] Dependency Versions: cffi: 1.14.6 cherrypy: unknown dateutil: 2.8.1 docker-py: Not Installed gitdb: Not Installed gitpython: Not Installed Jinja2: 3.1.2 libgit2: Not Installed looseversion: 1.0.2 M2Crypto: Not Installed Mako: Not Installed msgpack: 1.0.2 msgpack-pure: Not Installed mysql-python: Not Installed packaging: 22.0 pycparser: 2.21 pycrypto: Not Installed pycryptodome: 3.9.8 pygit2: Not Installed python-gnupg: 0.4.8 PyYAML: 5.4.1 PyZMQ: 23.2.0 relenv: 0.12.3 smmap: Not Installed timelib: 0.2.4 Tornado: 4.5.3 ZMQ: 4.3.4 System Versions: dist: centos 7.9.2009 Core locale: utf-8 machine: x86_64 release: 3.10.0-1160.88.1.el7.x86_64 system: Linux version: CentOS Linux 7.9.2009 Core ```
twangboy commented 1 year ago

I was able to replicate this on Centos 8 Stream by running the following state first to install the FTP Server:

pkgs_group_desktop_environment:
  pkg.group_installed:
    - name: FTP Server

Then I modified the state to include a package:

pkgs_group_desktop_environment:
  pkg.group_installed:
    - name: FTP Server
    - include:
      - vsftpd

I applied the state with test=True and observed the stack trace.

The key here is having the package group installed and then having an include.

I'm not a Linux Guru, so I don't know if it's possible for Salt to know that an include is already installed