pyinfra icon indicating copy to clipboard operation
pyinfra copied to clipboard

choco facts: `Invalid argument --local-only`

Open ronan-lg opened this issue 1 year ago • 0 comments

Describe the bug

With Chocolatey 2.0.0 (May 31, 2023), there was a breaking change: Change behavior of choco list to be local only - see #158.

Issue in pyinfra/facts/choco.py - ChocoPackages:

    command = "choco list --local-only"

To Reproduce

Steps to reproduce the behavior, please include where possible:

  • Operation code & usage

    choco.packages("cloc")
    
  • Target system information

    WindowsBuildLabEx              : 17763.1.amd64fre.rs5_release.180914-1434
    WindowsCurrentVersion          : 6.3
    WindowsEditionId               : ServerDatacenter
    WindowsInstallationType        : Server
    WindowsInstallDateFromRegistry : 12/4/2023 2:57:12 PM
    WindowsProductId               : 00430-00000-00000-AA841
    WindowsProductName             : Windows Server 2019 Datacenter
    WindowsRegisteredOrganization  : Amazon.com
    WindowsRegisteredOwner         : EC2
    
  • Example using the @docker connector (helps isolate the problem)

Expected behavior

No more use --local-only option:

    command = "choco list"

With output:

--> Starting operation: Choco/Packages (packages=cloc)
    [pyinfra\api\operations] Starting operation {'Choco/Packages'} on x.x.x.x
    [pyinfra\connectors\ssh] Running command on x.x.x.x: (pty=None) choco install -y cloc
[x.x.x.x] >>> choco install -y cloc
    [pyinfra\connectors\ssh] Waiting for exit status...
    [pyinfra\connectors\ssh] Command exit status: 0
    [x.x.x.x] Success

Meta

  • Include output of pyinfra --support.

     System: Windows
       Platform: Windows-10-10.0.22621-SP0
       Release: 10
       Machine: AMD64
     pyinfra: v2.8
     Executable: ...\.venv\Scripts\pyinfra.exe
     Python: 3.8.10 (CPython, MSC v.1928 64 bit (AMD64))
    
  • How was pyinfra installed (source/pip)?

    • venv+ pip
  • Include pyinfra-debug.log (if one was created)

  • Consider including output with -vv and --debug.

     --> Preparing Operations...  
      [pyinfra\api\operation] Adding operation, {'Choco/Packages'}, opOrder=(0, 36), opHash=c3a491381f47e26d8549af68b2c1c00373cd9671
      [pyinfra\api\facts] Getting fact: choco.ChocoPackages () (ensure_hosts: None)
      [pyinfra\connectors\ssh] Running command on x.x.x.x: (pty=None) choco list --local-only
    [x.x.x.x] >>> choco list --local-only
      [pyinfra\connectors\ssh] Waiting for exit status...
      [pyinfra\connectors\ssh] Command exit status: 1  
      [x.x.x.x] Chocolatey v2.2.2
      [x.x.x.x] Invalid argument --local-only. This argument has been removed from the list command and cannot be used.
      [x.x.x.x] Error: could not load fact: choco.ChocoPackages
    

ronan-lg avatar Dec 05 '23 17:12 ronan-lg