Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

Commit

Permalink
Update spec file and vault class to handle api changes within ansible.
Browse files Browse the repository at this point in the history
…Closes #343.
  • Loading branch information
chambridge committed Oct 2, 2017
1 parent 7c6d37b commit bd7a953
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
@@ -1,4 +1,4 @@
ansible==2.3.1.0
ansible
pexpect
future
sh
Expand Down
4 changes: 2 additions & 2 deletions rho.spec
Expand Up @@ -17,12 +17,12 @@ BuildRequires: python-setuptools
BuildRequires: pandoc
Requires: python-netaddr
Requires: python-crypto
Requires: ansible = 2.3.1.0
Requires: ansible
Requires: pexpect
Requires: python-six
Requires: python-enum34
Requires: python-yaml
Requires: epel-release
%{?rhel:Requires: epel-release}
Requires: python2-future
Requires: python2-sh
Requires: python2-pyxdg
Expand Down
10 changes: 9 additions & 1 deletion rho/vault.py
Expand Up @@ -87,7 +87,15 @@ class Vault(object):

def __init__(self, password):
self.password = password
self.vault = VaultLib(password)

try:
from ansible.parsing.vault import VaultSecret
from ansible.module_utils._text import to_bytes
pass_bytes = to_bytes(password, encoding='utf-8', errors='strict')
secrets = [('password', VaultSecret(_bytes=pass_bytes))]
self.vault = VaultLib(secrets=secrets)
except ImportError:
self.vault = VaultLib(password)

def load(self, stream):
""" Read vault steam and return python object
Expand Down

0 comments on commit bd7a953

Please sign in to comment.