Use auth section and refactor.

This commit is contained in:
Chmouel Boudjnah 2013-03-20 14:20:23 +01:00
parent e97a02240e
commit b5783cd9dc
3 changed files with 15 additions and 12 deletions

View File

@ -1,14 +1,16 @@
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import pickle
import argparse
import os
import pickle
import sys
import eventlet
from keystoneclient.v2_0 import client as ksclient
sys.path.append("../")
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from common.utils import get_config
from sync.filler import (load_index, load_containers_index,
create_swift_account, fill_swift,
@ -44,10 +46,14 @@ def main():
pile = eventlet.GreenPile(concurrency)
pool = eventlet.GreenPool(concurrency)
client = ksclient.Client(username=get_config('filler', 'a_username'),
password=get_config('filler', 'a_password'),
auth_url=get_config('filler', 'auth_url'),
tenant_name=get_config('filler', 'a_tenant'))
_config = get_config('auth',
'keystone_origin_admin_credentials').split(':')
tenant_name, username, password = _config
client = ksclient.Client(
auth_url=get_config('auth', 'keystone_origin'),
username=username,
password=password,
tenant_name=tenant_name)
if not args.create and not args.delete:
parser.print_help()

View File

@ -1,15 +1,12 @@
[auth]
keystone_origin = http://vm:5000/v2.0
keystone_origin_credentials = demo:demo:ADMIN
keystone_origin_admin_credentials = admin:admin:ADMIN
keystone_dest = http://vm2:5000/v2.0
keystone_origin_demo_credentials = demo:demo:ADMIN
keystone_dest_credentials = demo:demo:ADMIN
[filler]
a_username = admin
a_password = ADMIN
auth_url = http://vm:5000/v2.0
a_tenant = admin
swift_operator_role = Member
concurrency = 1

View File

@ -148,7 +148,7 @@ def delete_account(client, user_id, acc):
def swift_cnx(acc, user):
cnx = sclient.Connection(get_config('filler', 'auth_url'),
cnx = sclient.Connection(get_config('auth', 'keystone_origin'),
user=user,
key=get_config('filler', 'default_user_password'),
tenant_name=acc[0],