Browse Source

Allow for password prompting

If the users password isn't in their configuration
file, then use getpass to prompt for it instead.

Change-Id: Ib0d53e181fffc455e8555cdb26125f2891695387
changes/91/391991/1
Joshua Harlow 8 years ago
parent
commit
6a3ef5e1a7
  1. 7
      gertty/config.py

7
gertty/config.py

@ -12,6 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import getpass
import os
import ConfigParser
@ -29,7 +30,11 @@ class Config(object):
self.server = server
self.url = self.config.get(server, 'url')
self.username = self.config.get(server, 'username')
self.password = self.config.get(server, 'password')
if not self.config.has_option(server, 'password'):
password = getpass.getpass("Password for %s (%s): "
% (self.url, self.username))
else:
self.password = self.config.get(server, 'password')
if self.config.has_option(server, 'verify_ssl'):
self.verify_ssl = self.config.getboolean(server, 'verify_ssl')
else:

Loading…
Cancel
Save