ansible-collections / community.windows

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

win_scoop: Exception setting "CursorVisible" #503

Open rektide opened 1 year ago

rektide commented 1 year ago
SUMMARY

Many scoop packages fail to install with win_scoop, showing a common error:

"ERROR Exception setting \"CursorVisible\": \"The handle is invalid.",
ISSUE TYPE
COMPONENT NAME

community.windows.win_scoop aka win_scoop

ANSIBLE VERSION
ansible [core 2.14.3]
  config file = /home/rektide/src/compfuzor/ansible.cfg
  configured module search path = ['/home/rektide/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/rektide/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.11.2 (main, Feb 12 2023, 00:48:52) [GCC 12.2.0] (/usr/bin/python3)
  jinja version = 3.0.3
  libyaml = True
COLLECTION VERSION
community.windows             1.12.0
CONFIGURATION
CONFIG_FILE() = None
DEFAULT_HOST_LIST(env: ANSIBLE_INVENTORY) = ['/home/rektide/.ansible/xone']

inventory:

[win]
xone.local

[win:vars]
ansible_user=rektide
ansible_password=notmyrealpasswordduhthanks
ansible_connection=winrm
ansible_winrm_transport=ntlm
ansible_winrm_server_cert_validation=ignore

(side note, nodejs failed with the same error when I had some pretty boring custom ansible.cfg, but I've removed all configuration & that fixed nodejs, but I still see the issue in many cases.)

OS / ENVIRONMENT

Debian Testing host, Targetting a single Windows 19045.2728 (Windows 10 release dating to 2023/3/14) inventory machine

STEPS TO REPRODUCE
    - community.windows.win_scoop_bucket:                                               
        name: nerd-fonts                                                        
    - community.windows.win_scoop:
        name:
          - nodejs
EXPECTED RESULTS

Node.js installs

ACTUAL RESULTS
TASK [install nerd-fonts] ***************************************************************************************************************************************
task path: /home/rektide/src/compfuzor/nerd-fonts.win.pb:12
Using module file /usr/lib/python3/dist-packages/ansible_collections/community/windows/plugins/modules/win_scoop.ps1
Pipelining is enabled.
<xone.local> ESTABLISH WINRM CONNECTION FOR USER: rektide on PORT 5986 TO xone.local
EXEC (via pipeline wrapper)
fatal: [xone.local]: FAILED! => {
    "changed": false,
    "command": "powershell.exe C:\\Users\\rektide\\scoop\\shims\\scoop.ps1 install nodejs",
    "invocation": {
        "module_args": {
            "architecture": null,
            "global": false,
            "independent": false,
            "name": [
                "nodejs"
            ],
            "no_cache": false,
            "purge": false,
            "skip_checksum": false,
            "state": "present"
        }
    },
    "msg": "Error installing nodejs",
    "rc": 1,
    "stderr": "",
    "stderr_lines": [],
    "stdout": "Installing 'nodejs' (19.7.0) [64bit] [main]\nWARN  By installing you accept following license: MIT (https://spdx.org/licenses/MIT.html)\nStarting
download with aria2 ...\nERROR Exception setting \"CursorVisible\": \"The handle is invalid.\r\n\"\nERROR This application failed to install: main/nodejs\n",
    "stdout_lines": [
        "Installing 'nodejs' (19.7.0) [64bit] [main]",
        "WARN  By installing you accept following license: MIT (https://spdx.org/licenses/MIT.html)",
        "Starting download with aria2 ...",
        "ERROR Exception setting \"CursorVisible\": \"The handle is invalid.",
        "\"",
        "ERROR This application failed to install: main/nodejs"
    ]
}
Additional Notes

Some packages do install just fine. I also needed cmake and it installed fine.

I tried using global: True and that didn't seem to change anything.

I have yet to get any fonts to install. I can use win_scoop_bucket to add nerd-fonts bucket. But every font I've tried to install (Hack-NF, FiraCode-NF, many more) shows the same error as nodejs does.

These packages all install fine on the box in cmd.exe.

With apologies, /cc @JamieMagee , original module author.