Use auth section and refactor.
This commit is contained in:
parent
e97a02240e
commit
b5783cd9dc
@ -1,14 +1,16 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
# -*- encoding: utf-8 -*-
|
# -*- encoding: utf-8 -*-
|
||||||
import pickle
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import os
|
||||||
|
import pickle
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import eventlet
|
import eventlet
|
||||||
from keystoneclient.v2_0 import client as ksclient
|
from keystoneclient.v2_0 import client as ksclient
|
||||||
|
|
||||||
sys.path.append("../")
|
sys.path.append("../")
|
||||||
|
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
||||||
from common.utils import get_config
|
from common.utils import get_config
|
||||||
from sync.filler import (load_index, load_containers_index,
|
from sync.filler import (load_index, load_containers_index,
|
||||||
create_swift_account, fill_swift,
|
create_swift_account, fill_swift,
|
||||||
@ -44,10 +46,14 @@ def main():
|
|||||||
pile = eventlet.GreenPile(concurrency)
|
pile = eventlet.GreenPile(concurrency)
|
||||||
pool = eventlet.GreenPool(concurrency)
|
pool = eventlet.GreenPool(concurrency)
|
||||||
|
|
||||||
client = ksclient.Client(username=get_config('filler', 'a_username'),
|
_config = get_config('auth',
|
||||||
password=get_config('filler', 'a_password'),
|
'keystone_origin_admin_credentials').split(':')
|
||||||
auth_url=get_config('filler', 'auth_url'),
|
tenant_name, username, password = _config
|
||||||
tenant_name=get_config('filler', 'a_tenant'))
|
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:
|
if not args.create and not args.delete:
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
[auth]
|
[auth]
|
||||||
keystone_origin = http://vm:5000/v2.0
|
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_dest = http://vm2:5000/v2.0
|
||||||
|
keystone_origin_demo_credentials = demo:demo:ADMIN
|
||||||
keystone_dest_credentials = demo:demo:ADMIN
|
keystone_dest_credentials = demo:demo:ADMIN
|
||||||
|
|
||||||
|
|
||||||
[filler]
|
[filler]
|
||||||
a_username = admin
|
|
||||||
a_password = ADMIN
|
|
||||||
auth_url = http://vm:5000/v2.0
|
|
||||||
a_tenant = admin
|
|
||||||
swift_operator_role = Member
|
swift_operator_role = Member
|
||||||
concurrency = 1
|
concurrency = 1
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ def delete_account(client, user_id, acc):
|
|||||||
|
|
||||||
|
|
||||||
def swift_cnx(acc, user):
|
def swift_cnx(acc, user):
|
||||||
cnx = sclient.Connection(get_config('filler', 'auth_url'),
|
cnx = sclient.Connection(get_config('auth', 'keystone_origin'),
|
||||||
user=user,
|
user=user,
|
||||||
key=get_config('filler', 'default_user_password'),
|
key=get_config('filler', 'default_user_password'),
|
||||||
tenant_name=acc[0],
|
tenant_name=acc[0],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user