Skip to content

Commit

Permalink
Port vault-keyring.py to properly load the config. Fixes ansible#31304 (
Browse files Browse the repository at this point in the history
  • Loading branch information
sivel authored and alikins committed Oct 13, 2017
1 parent ecee475 commit e2f16cf
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions contrib/vault/vault-keyring.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,20 @@
import getpass
import keyring

import ansible.constants as C
from ansible.config.manager import ConfigManager, get_ini_config_value


def main():
(parser, config_path) = C.load_config_file()
if parser.has_option('vault', 'username'):
username = parser.get('vault', 'username')
else:
username = getpass.getuser()
config = ConfigManager()
username = get_ini_config_value(
config._parser,
dict(section='vault', key='username')
) or getpass.getuser()

if parser.has_option('vault', 'keyname'):
keyname = parser.get('vault', 'keyname')
else:
keyname = 'ansible'
keyname = get_ini_config_value(
config._parser,
dict(section='vault', key='keyname')
) or 'ansible'

if len(sys.argv) == 2 and sys.argv[1] == 'set':
intro = 'Storing password in "{}" user keyring using key name: {}\n'
Expand Down

0 comments on commit e2f16cf

Please sign in to comment.