mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
This commit is contained in:
parent
ecee475a3a
commit
e2f16cfaf7
1 changed files with 10 additions and 10 deletions
|
@ -65,20 +65,20 @@ import sys
|
||||||
import getpass
|
import getpass
|
||||||
import keyring
|
import keyring
|
||||||
|
|
||||||
import ansible.constants as C
|
from ansible.config.manager import ConfigManager, get_ini_config_value
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
(parser, config_path) = C.load_config_file()
|
config = ConfigManager()
|
||||||
if parser.has_option('vault', 'username'):
|
username = get_ini_config_value(
|
||||||
username = parser.get('vault', 'username')
|
config._parser,
|
||||||
else:
|
dict(section='vault', key='username')
|
||||||
username = getpass.getuser()
|
) or getpass.getuser()
|
||||||
|
|
||||||
if parser.has_option('vault', 'keyname'):
|
keyname = get_ini_config_value(
|
||||||
keyname = parser.get('vault', 'keyname')
|
config._parser,
|
||||||
else:
|
dict(section='vault', key='keyname')
|
||||||
keyname = 'ansible'
|
) or 'ansible'
|
||||||
|
|
||||||
if len(sys.argv) == 2 and sys.argv[1] == 'set':
|
if len(sys.argv) == 2 and sys.argv[1] == 'set':
|
||||||
intro = 'Storing password in "{}" user keyring using key name: {}\n'
|
intro = 'Storing password in "{}" user keyring using key name: {}\n'
|
||||||
|
|
Loading…
Reference in a new issue