ansible-collections / community.windows

Windows community collection for Ansible
https://galaxy.ansible.com/community/windows
GNU General Public License v3.0
206 stars 160 forks source link

win_unzip breaks when using beta Pscx version 4 #563

Open b-a0 opened 7 months ago

b-a0 commented 7 months ago
SUMMARY

To work around a known issue in Pscx 3.3.2 I tried the proposed workaround and installed the pre-release version: Install-Module pscx -AllowPrerelease -Force. That version renames Expand-Archive to Expand-PscxArchive.

This prevents overriding the built-in Expand-Archive, but the built-in command has a different parameter for the destination.

In the Pscx Expand-Archive this was -OutputPath and in the PowerShell Expand-Archive this is -DestinationPath. The win_unzip module expects the Pscx version and uses OutputPath.

So I can either install Pscx 3.3.2 and override several built in commands, or I can install Pscx 4.0.0 beta but then the win_unzip module breaks.

I understand this is a pre-release version of Pscx, but I thought I would bring it up such that it could be adjusted in time.

ISSUE TYPE
COMPONENT NAME

win_unzip

ANSIBLE VERSION
ansible [core 2.16.6]
  config file = None
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/user/.local/lib/python3.11/site-packages/ansible
  ansible collection location = /home/user/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/user/.local/bin/ansible
  python version = 3.11.8 (main, Feb 19 2024, 12:13:24) [GCC 9.4.0] (/usr/local/bin/python3)
  jinja version = 3.1.3
  libyaml = True
COLLECTION VERSION
# /home/user/.local/lib/python3.11/site-packages/ansible_collections
Collection        Version
----------------- -------
community.windows 2.2.0
CONFIGURATION
CONFIG_FILE() = None
OS / ENVIRONMENT

Running under WSL on Windows 10 22H2. Linux PC-NUMBER 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

STEPS TO REPRODUCE
  1. Start the ansible-console
  2. Install pre-release Pscx: community.windows.win_psmodule name=Pscx state=latest accept_license=true allow_prerelease=true
  3. Try to unzip: community.windows.win_unzip src="L:/Tmp/test.exe" dest="L:/Tmp/output"
community.windows.win_unzip src="L:/Tmp/test.exe" dest="L:/Tmp/output"
EXPECTED RESULTS

The self-extracting archive test.exe is extracted to to output.

ACTUAL RESULTS

I get a failed status with the message:

Msg: A parameter cannot be found that matches parameter name 'OutputPath'."

server | FAILED! => {
    "changed": false,
    "dest": "L:/Tmp/output",
    "msg": "Error expanding 'L:/Tmp/test.exe' to 'L:/Tmp/output'! Msg: A parameter cannot be found that matches parameter name 'OutputPath'.",
    "pscx_status": "present",
    "removed": false,
    "src": "L:/Tmp/test.exe"
}