expand user paths before returning options

This commit is contained in:
Michael Bonnet 2007-03-16 13:23:10 -04:00
parent 3976fe331f
commit 108e4da8c8
2 changed files with 12 additions and 7 deletions

View file

@ -80,7 +80,7 @@ def get_options():
parser.add_option("-c", "--config", dest="configFile",
help=_("use alternate configuration file"), metavar="FILE",
default="~/.koji/config")
parser.add_option("--keytab", help=_("specify a Kerberos keytab to use"))
parser.add_option("--keytab", help=_("specify a Kerberos keytab to use"), metavar="FILE")
parser.add_option("--principal", help=_("specify a Kerberos principal to use"))
parser.add_option("--runas", help=_("run as the specified user (requires special privileges)"))
parser.add_option("--user", help=_("specify user"))
@ -153,7 +153,12 @@ def get_options():
for name, value in defaults.iteritems():
if getattr(options, name, None) is None:
setattr(options, name, value)
dir_opts = ('topdir', 'cert', 'ca', 'serverca')
for name in dir_opts:
# expand paths here, so we don't have to worry about it later
value = os.path.expanduser(getattr(options, name))
setattr(options, name, value)
return options, cmd, args[1:]
def ensure_connection(session):
@ -3064,7 +3069,7 @@ def activate_session(session):
if options.noauth:
#skip authentication
pass
elif os.path.isfile(os.path.expanduser(options.cert)) or options.user:
elif os.path.isfile(options.cert) or options.user:
# authenticate using SSL client cert or user/password
session.login()
elif sys.modules.has_key('krbV'):