Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rofuentes opened this issue May 13, 2021 · 2 comments
Labels
Bug broken, incorrect, or confusing behavior Confirmed Salt engineer has confirmed bug/feature - often including a MCVE severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Milestone

Comments

@rofuentes
Copy link

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

@rofuentes rofuentes added Bug broken, incorrect, or confusing behavior needs-triage labels May 13, 2021
@rofuentes rofuentes changed the title [BUG] [BUG] 3000.9 apt package not removed using pkgrepo state May 13, 2021
@s0undt3ch
Copy link
Member

❯ 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.

@s0undt3ch s0undt3ch added Confirmed Salt engineer has confirmed bug/feature - often including a MCVE and removed needs-triage labels May 18, 2021
@sagetherage sagetherage added this to the Silicon milestone May 19, 2021
@sagetherage sagetherage added the severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around label May 19, 2021
@sagetherage sagetherage modified the milestones: Silicon, Approved May 19, 2021
@rofuentes
Copy link
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.

@rofuentes rofuentes 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 May 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior Confirmed Salt engineer has confirmed bug/feature - often including a MCVE severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Projects
None yet
Development

No branches or pull requests

3 participants