get_auth_token is now uses default configs

Change-Id: Iacec4f96e40d7ebb49b8939338564de88bd6372b
This commit is contained in:
Sergey Lukjanov 2013-04-01 21:52:03 +04:00
parent 355f1b92df
commit 16e351699d
2 changed files with 21 additions and 3 deletions

View File

@ -23,7 +23,7 @@ import sys
# If ../savanna/__init__.py exists, add ../ to Python search path, so that
# it will override what happens to be installed in /usr/(local/)lib/python...
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(__file__),
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
os.pardir,
os.pardir))
if os.path.exists(os.path.join(possible_topdir,

View File

@ -1,8 +1,17 @@
from keystoneclient.v2_0 import Client as keystone_client
import os
from oslo.config import cfg
import sys
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
os.pardir,
os.pardir))
if os.path.exists(os.path.join(possible_topdir,
'savanna',
'__init__.py')):
sys.path.insert(0, possible_topdir)
cli_opts = [
cfg.StrOpt('username', default='',
help='set username'),
@ -20,7 +29,16 @@ CONF.register_cli_opts(cli_opts)
def main():
CONF(sys.argv[1:], project='get_auth_token')
dev_conf = os.path.join(possible_topdir,
'etc',
'savanna',
'savanna.conf')
config_files = None
if os.path.exists(dev_conf):
config_files = [dev_conf]
CONF(sys.argv[1:], project='get_auth_token',
default_config_files=config_files)
user = CONF.username or CONF.os_admin_username
password = CONF.password or CONF.os_admin_password