saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Install Salt from the Salt package repositories here:
https://docs.saltproject.io/salt/install-guide/en/latest/
Apache License 2.0
14.19k stars 5.48k forks source link

Salt-Minion Windows pip module has trouble verifying when a local WHL package is installed. #58982

Open wildk1w1 opened 3 years ago

wildk1w1 commented 3 years ago

Description of Issue

On a salt inion running Windows pip.install from a whl package works but the pip module is unable to parse the p.freeze output to verify the module is installed.

Setup

M2Crypto: file.managed:

M2Crypto_whl: pip.installed:

Steps to Reproduce Issue

On first run of the above state: local:

      ID: M2Crypto
Function: file.managed
    Name: c:\salt\bin\Scripts\M2Crypto-0.36.0-cp37-cp37m-win_amd64.whl
  Result: True
 Comment: File c:\salt\bin\Scripts\M2Crypto-0.36.0-cp37-cp37m-win_amd64.whl is in the correct state
 Started: 05:44:12.921875
Duration: 113.763 ms
 Changes:

      ID: M2Crypto_whl
Function: pip.installed
    Name: M2Crypto-0.36.0-cp37-cp37m-win_amd64.whl
  Result: True
 Comment: There was no error installing package 'M2Crypto-0.36.0-cp37-cp37m-win_amd64.whl' although it does not show when calling 'pip.freeze'.
 Started: 05:44:15.946643
Duration: 3875.569 ms
 Changes:

On further runs we see an error message produced.

[ERROR ] Can't parse line 'M2Crypto @ file:///C:/salt/bin/Scripts/M2Crypto-0.36.0-cp37-cp37m-win_amd64.whl'

Versions Report

PS C:\salt\bin> salt-call -V Salt Version: Salt: 3002.1

Dependency Versions: cffi: 1.12.2 cherrypy: 17.4.1 dateutil: 2.8.0 docker-py: Not Installed gitdb: 2.0.5 gitpython: Not Installed Jinja2: 2.10.1 libgit2: Not Installed M2Crypto: 0.36.0 Mako: 1.0.7 msgpack-pure: Not Installed msgpack-python: 1.0.0 mysql-python: Not Installed pycparser: 2.19 pycrypto: Not Installed pycryptodome: 3.9.8 pygit2: Not Installed Python: 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)] python-gnupg: 0.4.4 PyYAML: 5.3.1 PyZMQ: 18.0.1 smmap: 2.0.5 timelib: 0.2.4 Tornado: 4.5.3 ZMQ: 4.3.1

System Versions: dist: locale: cp1252 machine: AMD64 release: 2016Server system: Windows version: 2016Server 10.0.14393 SP0

PS C:\salt\bin> salt-call pip.freeze local:

welcome[bot] commented 3 years ago

Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey. Please be sure to review our Code of Conduct. Also, check out some of our community resources including:

There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar. If you have additional questions, email us at core@saltstack.com. We’re glad you’ve joined our community and look forward to doing awesome things with you!

wildk1w1 commented 3 years ago

Also verified that this is the same on 3000, 3001, and 3002 versions of SaltStack

xeacott commented 3 years ago

Probably either the path its installing into .... or where pip.freeze looks is getting lost somewhere. I'll take a look at this thanks for submitting.

amalaguti commented 3 years ago

@xeacott I'm facing this same problem. If it helps here you go some more info, i guess it's looking for the wrong pattern.

pip freeze shows: watchdog @ file:///C:/salt/bin/Scripts/watchdog-2.0.2-py3-none-win_amd64.whl

pip list shows: watchdog 2.0.2

IN the minion log you get: [ERROR ] Can't parse line 'watchdog @ file:///C:/salt/bin/Scripts/watchdog-2.0.2-py3-none-win_amd64.whl' [INFO ] There was no error installing package 'watchdog-2.0.2-py3-none-win_amd64.whl' although it does not show when calling 'pip.freeze'.

copy_local_file:
  file.managed:
    - name: 'C:\salt\bin\Scripts\watchdog-2.0.2-py3-none-win_amd64.whl'
    - source: salt://watchdog/files/watchdog-2.0.2-py3-none-win_amd64.whl
install_watchdog:
  pip.installed:
    - name: 'watchdog-2.0.2-py3-none-win_amd64.whl'
    - cwd: 'C:\salt\bin\Scripts'
    - bin_env: 'C:\salt\bin\Scripts\pip.exe'
    - upgrade: True
    - no_index: True
    - find_links: 'C:\salt\bin\Scripts'