Skip to content

[BUG] 3000.9 apt one line data source not commented out when using pkgrepo.managed with disabled=true #60184

Closed

Description

@rofuentes

Description
During our migration from Py2 to Py3 I attempted to use both pkgrepo.managed and pkgrepo.absent state modules to add the Py3 apt repository and remove the Py2. I cannot figure out how to remove the Py2 repository. I get success messages, but the line is still present in saltstack.list

Setup/Reproduction

State

saltstack-py2-repo:
  pkgrepo.managed:
    - name: deb http://repo.saltstack.com/apt/debian/9/amd64/latest/ stretch main
    - file: /etc/apt/sources.list.d/saltstack.list
    - disabled: True

Output

          ID: saltstack-py2-repo                                                                                                            
    Function: pkgrepo.managed                                                                                                               
        Name: deb http://repo.saltstack.com/apt/debian/9/amd64/latest/ stretch main                                                         
      Result: True                                                                                                                          
     Comment: Package repo 'deb http://repo.saltstack.com/apt/debian/9/amd64/latest/ stretch main' already configured                       
     Started: 23:13:58.509643                                                                                                               
    Duration: 32.214 ms                                                                                                                     
     Changes:  

These states were not used at the same time, I modified the file and ran each separately.

State

saltstack-py2-repo:
  pkgrepo.absent:
    - name: http://repo.saltstack.com/apt/debian/9/amd64/latest/ stretch InRelease

Output

         ID: saltstack-py2-repo                                                                                                            
    Function: pkgrepo.absent                                                                                                                
        Name: http://repo.saltstack.com/apt/debian/9/amd64/latest/ stretch InRelease                                                        
      Result: True                                                                                                                          
     Comment: Package repo http://repo.saltstack.com/apt/debian/9/amd64/latest/ stretch InRelease is absent                                 
     Started: 23:09:46.118244                                                                                                               
    Duration: 32.505 ms                                                                                                                     
     Changes:                                                                                                                               

Expected behavior
A clear and concise description of what you expected to happen.
The repository is removed from saltstack.list

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
           Salt: 3000.9
 
Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.5.3
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
         Jinja2: 2.9.4
        libgit2: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.6.2
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: 3.6.1
         pygit2: Not Installed
         Python: 3.5.3 (default, Apr  5 2021, 09:00:41)
   python-gnupg: 0.3.9
         PyYAML: 3.12
          PyZMQ: 17.1.2
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.2.1
 
System Versions:
           dist: debian 9.13 
         locale: UTF-8
        machine: x86_64
        release: 4.9.0-15-amd64
         system: Linux
        version: debian 9.13 

Additional context
n/a

Activity

  1. added
    bug
    on May 13, 2021
  2. changed the title [-][BUG][/-] [+][BUG] 3000.9 apt package not removed using pkgrepo state[/+] on May 13, 2021
  3. s0undt3ch commented on May 18, 2021

    @s0undt3ch
    Contributor
    ❯ docker pull debian:9
    9: Pulling from library/debian
    bfde2ec33fbc: Pull complete
    Digest: sha256:4f8deed5755299e2d7ae1f5649656de89a6b7e30c0be37a3a1b4a49f0af51f7e
    Status: Downloaded newer image for debian:9
    docker.io/library/debian:9
    
    Installed Salt Grains Information
    # salt-call --local -g
    local:
        ----------
        SSDs:
            - dm-1
            - nvme0n1
            - dm-4
            - dm-2
            - dm-0
            - nvme1n1
            - dm-3
        biosreleasedate:
            12/06/2019
        biosversion:
            N1EET87W (1.60 )
        cpu_flags:
            - fpu
            - vme
            - de
            - pse
            - tsc
            - msr
            - pae
            - mce
            - cx8
            - apic
            - sep
            - mtrr
            - pge
            - mca
            - cmov
            - pat
            - pse36
            - clflush
            - dts
            - acpi
            - mmx
            - fxsr
            - sse
            - sse2
            - ss
            - ht
            - tm
            - pbe
            - syscall
            - nx
            - pdpe1gb
            - rdtscp
            - lm
            - constant_tsc
            - art
            - arch_perfmon
            - pebs
            - bts
            - rep_good
            - nopl
            - xtopology
            - nonstop_tsc
            - cpuid
            - aperfmperf
            - pni
            - pclmulqdq
            - dtes64
            - monitor
            - ds_cpl
            - vmx
            - est
            - tm2
            - ssse3
            - sdbg
            - fma
            - cx16
            - xtpr
            - pdcm
            - pcid
            - sse4_1
            - sse4_2
            - x2apic
            - movbe
            - popcnt
            - tsc_deadline_timer
            - aes
            - xsave
            - avx
            - f16c
            - rdrand
            - lahf_lm
            - abm
            - 3dnowprefetch
            - cpuid_fault
            - epb
            - invpcid_single
            - pti
            - ssbd
            - ibrs
            - ibpb
            - stibp
            - tpr_shadow
            - vnmi
            - flexpriority
            - ept
            - vpid
            - ept_ad
            - fsgsbase
            - tsc_adjust
            - bmi1
            - hle
            - avx2
            - smep
            - bmi2
            - erms
            - invpcid
            - rtm
            - mpx
            - rdseed
            - adx
            - smap
            - clflushopt
            - intel_pt
            - xsaveopt
            - xsavec
            - xgetbv1
            - xsaves
            - dtherm
            - ida
            - arat
            - pln
            - pts
            - hwp
            - hwp_notify
            - hwp_act_window
            - hwp_epp
            - md_clear
            - flush_l1d
        cpu_model:
            Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
        cpuarch:
            x86_64
        cwd:
            /testing
        disks:
            - sda
        dns:
            ----------
            domain:
            ip4_nameservers:
                - 192.168.1.254
            ip6_nameservers:
            nameservers:
                - 192.168.1.254
            options:
            search:
                - lan
            sortlist:
        domain:
        fqdn:
            f51bb4d09ac7
        fqdn_ip4:
            - 172.17.0.2
        fqdn_ip6:
        fqdns:
        gid:
            0
        gpus:
        groupname:
            root
        host:
            f51bb4d09ac7
        hwaddr_interfaces:
            ----------
            eth0:
                02:42:ac:11:00:02
            lo:
                00:00:00:00:00:00
        id:
            f51bb4d09ac7
        init:
            unknown
        ip4_gw:
            172.17.0.1
        ip4_interfaces:
            ----------
            eth0:
                - 172.17.0.2
            lo:
                - 127.0.0.1
        ip6_gw:
            False
        ip6_interfaces:
            ----------
            eth0:
            lo:
        ip_gw:
            True
        ip_interfaces:
            ----------
            eth0:
                - 172.17.0.2
            lo:
                - 127.0.0.1
        ipv4:
            - 127.0.0.1
            - 172.17.0.2
        ipv6:
        kernel:
            Linux
        kernelrelease:
            5.12.2-arch1-1
        kernelversion:
            #1 SMP PREEMPT Fri, 07 May 2021 15:36:06 +0000
        locale_info:
            ----------
            defaultencoding:
                UTF-8
            defaultlanguage:
                en_US
            detectedencoding:
                ANSI_X3.4-1968
            timezone:
                UTC
        localhost:
            f51bb4d09ac7
        lsb_distrib_codename:
            stretch
        lsb_distrib_description:
            Debian GNU/Linux 9.13 (stretch)
        lsb_distrib_id:
            Debian
        lsb_distrib_os:
            GNU/Linux
        lsb_distrib_release:
            9.13
        machine_id:
            16d0468f31e32cbbc5e3e0e1e1a942bf
        manufacturer:
            LENOVO
        master:
            salt
        mem_total:
            64014
        nodename:
            f51bb4d09ac7
        num_cpus:
            8
        num_gpus:
            0
        os:
            Debian
        os_family:
            Debian
        osarch:
            amd64
        oscodename:
            stretch
        osfinger:
            Debian-9
        osfullname:
            Debian
        osmajorrelease:
            9
        osrelease:
            9.13
        osrelease_info:
            - 9
            - 13
        path:
            /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
        pid:
            4796
        productname:
            20ENCTO1WW
        ps:
            ps -efHww
        pythonexecutable:
            /usr/bin/python2
        pythonpath:
            - /usr/bin
            - /usr/lib/python2.7
            - /usr/lib/python2.7/plat-x86_64-linux-gnu
            - /usr/lib/python2.7/lib-tk
            - /usr/lib/python2.7/lib-old
            - /usr/lib/python2.7/lib-dynload
            - /usr/local/lib/python2.7/dist-packages
            - /usr/lib/python2.7/dist-packages
        pythonversion:
            - 2
            - 7
            - 13
            - final
            - 0
        saltpath:
            /usr/lib/python2.7/dist-packages/salt
        saltversion:
            3000.9
        saltversioninfo:
            - 3000
            - 9
        serialnumber:
            PC0BGGWG
        server_id:
            573092508
        shell:
            /bin/sh
        swap_total:
            65535
        uid:
            0
        username:
            root
        uuid:
            f43096cc-316f-11b2-a85c-fa4dd8cce392
        virtual:
            physical
        zfs_feature_flags:
            False
        zfs_support:
            False
        zmqversion:
            4.2.1
    
    Manually run the state
    # salt-call --local state.single pkgrepo.managed name='deb http://repo.saltstack.com/apt/debian/9/amd64/latest/ stretch main' file=/etc/apt/sources.list.d/saltstack.list disabled=true
    local:
    ----------
              ID: deb http://repo.saltstack.com/apt/debian/9/amd64/latest/ stretch main
        Function: pkgrepo.managed
          Result: True
         Comment: Configured package repo 'deb http://repo.saltstack.com/apt/debian/9/amd64/latest/ stretch main'
         Started: 04:52:00.666269
        Duration: 7201.139 ms
         Changes:
                  ----------
                  repo:
                      deb http://repo.saltstack.com/apt/debian/9/amd64/latest stretch main
    

    Summary for local

    Succeeded: 1 (changed=1)
    Failed: 0

    Total states run: 1
    Total run time: 7.201 s

    Manually run the state - Second time
    # salt-call --local state.single pkgrepo.managed name='deb http://repo.saltstack.com/apt/debian/9/amd64/latest/ stretch main' file=/etc/apt/sources.list.d/saltstack.list disabled=true
    local:
    ----------
              ID: deb http://repo.saltstack.com/apt/debian/9/amd64/latest/ stretch main
        Function: pkgrepo.managed
          Result: True
         Comment: Package repo 'deb http://repo.saltstack.com/apt/debian/9/amd64/latest/ stretch main' already configured
         Started: 04:53:07.678455
        Duration: 48.795 ms
         Changes:
    

    Summary for local

    Succeeded: 1
    Failed: 0

    Total states run: 1
    Total run time: 48.795 ms

    But now I ended with 2 .list files.

    Anyway, you need to exactly match the line contained in the .list file, or you'll end up with double entries, but still, I was unable to disable the repo.

  4. added
    Confirmed
    and removed on May 18, 2021
  5. added this to the Silicon milestone on May 19, 2021
  6. added
    severity-medium
    on May 19, 2021
  7. modified the milestones: Silicon, Approved on May 19, 2021
  8. rofuentes commented on May 28, 2021

    @rofuentes
    Author

    I was able to remove the SaltStack Python 2 repository with the following state

    saltstack-python2-repo:
      pkgrepo.absent:
        - name: deb http://repo.saltstack.com/apt/debian/9/amd64/latest stretch main
    

    So I guess the issue really is, if I pass the disabled=true argument when using pkgrepo.managed module, and the apt data source is configured as a one line and not DEB822, the line should be commented out.

  9. changed the title [-][BUG] 3000.9 apt package not removed using pkgrepo state[/-] [+][BUG] 3000.9 apt one line data source not commented out when using pkgrepo.managed with disabled=true[/+] on May 28, 2021
  10. modified the milestones: Approved, Sulphur v3006.26 on Jul 2, 2026
  11. dwoz commented on Jul 2, 2026

    @dwoz
    Contributor

    Fix merged and shipped in a supported release. Closing per bulk triage. Reopen if this reproduces on a currently supported release (3006.x, 3007.x, 3008.x, master).

  12. added 2 commits that reference this issue on Jul 3, 2026
    900d6b1
    537cd09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Confirmedbugseverity-medium

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions