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
This commit is contained in:
parent
b3ea5cf5e2
commit
6a3ef5e1a7
@ -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…
x
Reference in New Issue
Block a user