How to install m2crypto for Salt on Windows?

285 views Asked by At

I compiled the newest m2crypto for some x509 action, got a M2Crypto-0.38.0-cp37-cp37m-win_amd64.whl out of it and installed this via pip.

Now I have a lot of files under C:\salt\bin\Lib\site-packages\M2Crypto\ like m2crypto.py and x509.py. However, my state which works under Linux gives me still the debug output:

Reason: 'x509' __virtual__ returned False: Could not load x509 state: m2crypto unavailable

I copied all files from C:\salt\bin\Lib\site-packages\M2Crypto\ to C:\salt\bin\Lib\site-packages\salt-3003.3-py3.7.egg\salt\modules without overwrite, but that didn't help.

I restarted the salt-minion service.

What am I supposed to do?

1

There are 1 answers

6
OrangeDog On

The easiest way to ensure python libraries are in the correct place for Salt is to use the pip.installed state:

install m2crypto:
  pip.installed:
    - name: path/to/M2Crypto-0.38.0-cp37-cp37m-win_amd64.whl
    - reload_modules: true

There seems to be pre-built packages available on pypi, which may be easier:

install m2crypto:
  pip.installed:
    - name: M2CryptoWin64
    - reload_modules: true

Your x509 states should then require install m2crypto.

Inside ...\salt\modules is very wrong, and you should try to undo that (or reinstall salt).