tomoh1r / ansible-vault

This project aim to R/W an ansible-vault yaml file
GNU General Public License v3.0
54 stars 32 forks source link

Fix version comparison logic #34

Closed stevebeck89 closed 3 years ago

stevebeck89 commented 4 years ago

Recommended fix for Issue https://github.com/tomoh1r/ansible-vault/issues/32

Update version comparison to use pkg_resources, using this instead of packaging.version.parse for backwards compatibility.

Tested the pkg_resources.parse_version and comparison logic in python 2.7.16 and 3.6.5.

Pulled information from https://stackoverflow.com/questions/11887762/how-do-i-compare-version-numbers-in-python

aeons commented 4 years ago

@tomoh1r Could you take a look at this? It's blocking using this library with ansible 2.10+

Andy-Fraley commented 4 years ago

@tomoh1r Could you take a look at this? It's blocking using this library with ansible 2.10+

I'm blocked by this too. @stevebeck89 fix looks good to me. I too would love to see pull request accepted so ansible_vault package can be used with ansible 2.10+

obieeclark commented 4 years ago

This backwards compatibility logic is blocking me too.

brokenjacobs commented 4 years ago

any chance of someone forking this project to maintain it?

aeons commented 4 years ago

The entire project is 50 lines. We reimplemented the few parts we use directly.

dfaubion-zinc commented 4 years ago

:+1:

tardyp commented 3 years ago

The few parts are indeed actually 4 lines:

from ansible.parsing.vault import VaultLib, VaultSecret
from ansible.constants import DEFAULT_VAULT_ID_MATCH

vault = VaultLib([(DEFAULT_VAULT_ID_MATCH, VaultSecret(passwd.encode()))])
secrets = yaml.safe_load(vault.decrypt(open("./vault.yml").read()))
tomoh1r commented 3 years ago

Thanks!

tomoh1r commented 3 years ago

Sorry too late responses, I merged, and released https://pypi.org/project/ansible-vault/2.0.0/.