Skip to content

Commit 7779ec8

Browse files
author
Dan Ellis
committed
Update vault decryption to use ansible built-in util.
It does some special stuff like strip newlines from the end.
1 parent aeb24c0 commit 7779ec8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ansible_toolkit/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44

55
from ansible.inventory import Inventory
6+
from ansible.utils import read_vault_file
67

78

89
config = ConfigParser.ConfigParser()
@@ -30,8 +31,7 @@ def red(text):
3031
def get_vault_password():
3132
try:
3233
password_file = config.get('vault', 'password_file')
33-
with open(os.path.expanduser(password_file), 'rb') as f:
34-
return f.read()
34+
return read_vault_file(password_file)
3535
except ConfigParser.NoSectionError:
3636
return None
3737

0 commit comments

Comments
 (0)