forked from iranzo/rhevm-utils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathovirt-keyring.py
executable file
·41 lines (33 loc) · 1.44 KB
/
ovirt-keyring.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python
#
# Author: Pablo Iranzo Gomez ([email protected])
#
# Description: Script for setting the keyring password for RHEV scripts
#
# Requires: python keyring
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
from ovirt_functions import *
description = """
RHEV-keyring is a script for mantaining the keyring used by rhev script for storing password
"""
#Parse args in ovirt_functions: parseoptions(basename, description, args)
options = parseoptions(sys.argv[0], description, sys.argv[1:])
if options.askpassword:
options.password = getpass.getpass("Enter password: ")
# keyring.set_password('redhat', 'kerberos', '<password>')
# remotepasseval = keyring.get_password('redhat', 'kerberos')
if options.query:
print "Username: %s" % keyring.get_password('rhevm-utils', 'username')
print "Password: %s" % keyring.get_password('rhevm-utils', 'password')
if options.username:
keyring.set_password('rhevm-utils', 'username', options.username)
if options.password:
keyring.set_password('rhevm-utils', 'password', options.password)