Fix Ranger maria db script, docker proxy , oslo_config issues
Change-Id: Ia454ce25a439580b9be28a2bb817c228fe9199fd
This commit is contained in:
parent
242640c855
commit
cdbd0f5c7b
@ -42,7 +42,7 @@ OrmOpts = [
|
|||||||
CONF.register_opts(OrmOpts)
|
CONF.register_opts(OrmOpts)
|
||||||
|
|
||||||
# Keystone config options in [keystone_autotoken] group
|
# Keystone config options in [keystone_autotoken] group
|
||||||
orm_token_group = cfg.OptGroup(name='token',
|
orm_token_group = cfg.OptGroup(name='keystone_authtoken',
|
||||||
title='Orm Keystone Token Options')
|
title='Orm Keystone Token Options')
|
||||||
|
|
||||||
OrmAuthGroup = [
|
OrmAuthGroup = [
|
||||||
@ -58,12 +58,20 @@ OrmAuthGroup = [
|
|||||||
cfg.StrOpt('region',
|
cfg.StrOpt('region',
|
||||||
default='local',
|
default='local',
|
||||||
help='Region.'),
|
help='Region.'),
|
||||||
|
cfg.BoolOpt('auth_enabled',
|
||||||
|
default=False,
|
||||||
|
help='Auth token Enabled/Disabled.'),
|
||||||
|
cfg.StrOpt('version',
|
||||||
|
default='v3',
|
||||||
|
help='Keystone version number.'),
|
||||||
cfg.StrOpt('project_domain_name',
|
cfg.StrOpt('project_domain_name',
|
||||||
default='default',
|
default='default',
|
||||||
help='Project domain name.'),
|
help='Project domain name.'),
|
||||||
cfg.StrOpt('user_domain_name',
|
cfg.StrOpt('user_domain_name',
|
||||||
default='default',
|
default='default',
|
||||||
help='User domain name.')
|
help='User domain name.'),
|
||||||
|
cfg.StrOpt('user_role',
|
||||||
|
help='token user role.')
|
||||||
]
|
]
|
||||||
|
|
||||||
CONF.register_group(orm_token_group)
|
CONF.register_group(orm_token_group)
|
||||||
@ -232,17 +240,17 @@ debug_level = CONF.debug_level
|
|||||||
protocol = CONF.protocol
|
protocol = CONF.protocol
|
||||||
orm_host = CONF.orm_host
|
orm_host = CONF.orm_host
|
||||||
ranger_base = CONF.ranger_base
|
ranger_base = CONF.ranger_base
|
||||||
db_user = 'root'
|
|
||||||
db_pass = 'devstack'
|
|
||||||
db_host = '127.0.0.1'
|
|
||||||
ssl_verify = CONF.ssl_verify
|
ssl_verify = CONF.ssl_verify
|
||||||
token_auth_enabled = False
|
token_auth_enabled = CONF.keystone_authtoken.auth_enabled
|
||||||
token_auth_user = CONF.token.username
|
token_auth_user = CONF.keystone_authtoken.username
|
||||||
token_auth_pass = CONF.token.password
|
token_auth_pass = CONF.keystone_authtoken.password
|
||||||
token_auth_tenant = CONF.token.project_name
|
token_auth_tenant = CONF.keystone_authtoken.project_name
|
||||||
token_auth_user_role = 'admin'
|
token_auth_user_role = CONF.keystone_authtoken.user_role
|
||||||
|
conn = CONF.database.connection
|
||||||
|
db_connect = conn.replace("mysql+pymysql", "mysql") if conn else None
|
||||||
|
# pass keystone version '2.0' or '3'
|
||||||
|
token_auth_version = '3' if (CONF.keystone_authtoken.version == 'v3') else '2.0'
|
||||||
|
|
||||||
db_url = 'mysql://{}:{}@{}:3306/'.format(db_user, db_pass, db_host)
|
|
||||||
|
|
||||||
uuid = {'port': CONF.uuid.port,
|
uuid = {'port': CONF.uuid.port,
|
||||||
'base_url': '{}://{}:{}/'.
|
'base_url': '{}://{}:{}/'.
|
||||||
|
@ -1,58 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# Copyright (c) 2012 OpenStack Foundation
|
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
# not use this file except in compliance with the License. You may obtain
|
|
||||||
# a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
# License for the specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
|
|
||||||
import orm.base_config as config
|
|
||||||
from oslo_config import cfg
|
|
||||||
from sqlalchemy import *
|
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
def main(argv=None):
|
|
||||||
|
|
||||||
if argv is None:
|
|
||||||
argv = sys.argv
|
|
||||||
cfg.CONF(argv[1:], project='ranger', validate_default_values=True)
|
|
||||||
|
|
||||||
sql_queries = []
|
|
||||||
|
|
||||||
orm_dbs = [
|
|
||||||
config.ranger_base + '/orm/services/audit_trail_manager/scripts/db_scripts/create_db.sql',
|
|
||||||
config.ranger_base + '/orm/services/id_generator/scripts/db_scripts/db_create.sql',
|
|
||||||
config.ranger_base + '/orm/services/resource_distributor/scripts/db_scripts/create_db.sql',
|
|
||||||
config.ranger_base + '/orm/services/region_manager/scripts/db_scripts/create_db.sql',
|
|
||||||
config.ranger_base +
|
|
||||||
'/orm/services/customer_manager/scripts/db_scripts/ranger_cms_create_db.sql',
|
|
||||||
config.ranger_base +
|
|
||||||
'/orm/services/customer_manager/scripts/db_scripts/ranger_cms_update_db.sql',
|
|
||||||
config.ranger_base +
|
|
||||||
'/orm/services/flavor_manager/scripts/db_scripts/ranger_fms_create_db.sql',
|
|
||||||
config.ranger_base + '/orm/services/image_manager/scripts/db_scripts/create_db.sql'
|
|
||||||
]
|
|
||||||
|
|
||||||
for item in range(len(orm_dbs)):
|
|
||||||
sql_file = open(orm_dbs[item], "r")
|
|
||||||
query = sql_file.read()
|
|
||||||
sql_queries.append(query)
|
|
||||||
sql_file.close()
|
|
||||||
|
|
||||||
engine = create_engine(config.db_url, echo=False)
|
|
||||||
|
|
||||||
for exec_item in range(len(sql_queries)):
|
|
||||||
conn = engine.connect()
|
|
||||||
exec_script = conn.execute(sql_queries[exec_item])
|
|
||||||
conn.close()
|
|
||||||
|
|
||||||
print 'Ranger databases setup complete'
|
|
@ -14,7 +14,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import db_setup
|
from orm.services import db_setup
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
@ -7,9 +7,11 @@ server = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# DB configurations
|
# DB configurations
|
||||||
|
|
||||||
|
db_url = config.db_connect
|
||||||
|
|
||||||
database = {
|
database = {
|
||||||
'url': config.db_url + 'orm_audit?charset=utf8',
|
'url': db_url.endswith('/orm') and db_url.replace("/orm", "/orm_audit") or (db_url + 'orm_audit'),
|
||||||
# 'url': 'mysql://root:root@127.0.0.1/orm_audit?charset=utf8',
|
|
||||||
'echo_statements': True
|
'echo_statements': True
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,8 +90,11 @@ quotas_default_values = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# DB configurations
|
||||||
|
db_url = config.db_connect
|
||||||
|
|
||||||
database = {
|
database = {
|
||||||
'connection_string': config.db_url + 'orm_cms_db'
|
'connection_string': db_url.endswith('/orm') and db_url.replace("/orm", "/orm_cms_db") or (db_url + 'orm_cms_db')
|
||||||
}
|
}
|
||||||
|
|
||||||
api = {
|
api = {
|
||||||
@ -128,8 +131,8 @@ authentication = {
|
|||||||
# The Keystone collection under which the role was granted.
|
# The Keystone collection under which the role was granted.
|
||||||
# The key can be either "tenant" (for Keystone v2.0) or "domain"
|
# The key can be either "tenant" (for Keystone v2.0) or "domain"
|
||||||
# (for Keystone v3) and the value is the tenant/domain name.
|
# (for Keystone v3) and the value is the tenant/domain name.
|
||||||
"role_location": {"tenant": "admin"},
|
"role_location": {"domain": "admin"},
|
||||||
# The Keystone version currently in use. Can be either "2.0" or "3".
|
# The Keystone version currently in use. Can be either "2.0" or "3".
|
||||||
"keystone_version": "2.0",
|
"keystone_version": config.token_auth_version,
|
||||||
"policy_file": config.cms['policy_file']
|
"policy_file": config.cms['policy_file']
|
||||||
}
|
}
|
||||||
|
82
orm/services/db_setup.py
Normal file
82
orm/services/db_setup.py
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# Copyright (c) 2012 OpenStack Foundation
|
||||||
|
# All Rights Reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
from oslo_config import cfg
|
||||||
|
from sqlalchemy import *
|
||||||
|
import sys
|
||||||
|
|
||||||
|
CONF = cfg.CONF
|
||||||
|
|
||||||
|
|
||||||
|
def main(argv=None):
|
||||||
|
|
||||||
|
if argv is None:
|
||||||
|
argv = sys.argv
|
||||||
|
cfg.CONF(argv[1:], project='ranger', validate_default_values=True)
|
||||||
|
|
||||||
|
OrmOpts = [
|
||||||
|
cfg.StrOpt('ranger_base',
|
||||||
|
default='/opt/stack/ranger',
|
||||||
|
help='Orm base directory.'),
|
||||||
|
]
|
||||||
|
|
||||||
|
CONF.register_opts(OrmOpts)
|
||||||
|
|
||||||
|
orm_database_group = cfg.OptGroup(name='database',
|
||||||
|
title='Orm Database Options')
|
||||||
|
OrmDatabaseGroup = [
|
||||||
|
cfg.StrOpt('connection',
|
||||||
|
help='The SQLAlchemy connection string to use to connect to '
|
||||||
|
'the ORM database.',
|
||||||
|
secret=True),
|
||||||
|
cfg.IntOpt('max_retries',
|
||||||
|
default=-1,
|
||||||
|
help='The maximum number of retries for database connection.')
|
||||||
|
]
|
||||||
|
|
||||||
|
CONF.register_group(orm_database_group)
|
||||||
|
CONF.register_opts(OrmDatabaseGroup, orm_database_group)
|
||||||
|
|
||||||
|
sql_queries = []
|
||||||
|
|
||||||
|
orm_dbs = [
|
||||||
|
CONF.ranger_base + '/orm/services/audit_trail_manager/scripts/db_scripts/create_db.sql',
|
||||||
|
CONF.ranger_base + '/orm/services/id_generator/scripts/db_scripts/db_create.sql',
|
||||||
|
CONF.ranger_base + '/orm/services/resource_distributor/scripts/db_scripts/create_db.sql',
|
||||||
|
CONF.ranger_base + '/orm/services/region_manager/scripts/db_scripts/create_db.sql',
|
||||||
|
CONF.ranger_base +
|
||||||
|
'/orm/services/customer_manager/scripts/db_scripts/ranger_cms_create_db.sql',
|
||||||
|
CONF.ranger_base +
|
||||||
|
'/orm/services/customer_manager/scripts/db_scripts/ranger_cms_update_db.sql',
|
||||||
|
CONF.ranger_base +
|
||||||
|
'/orm/services/flavor_manager/scripts/db_scripts/ranger_fms_create_db.sql',
|
||||||
|
CONF.ranger_base + '/orm/services/image_manager/scripts/db_scripts/create_db.sql'
|
||||||
|
]
|
||||||
|
|
||||||
|
for item in range(len(orm_dbs)):
|
||||||
|
sql_file = open(orm_dbs[item], "r")
|
||||||
|
query = sql_file.read()
|
||||||
|
sql_queries.append(query)
|
||||||
|
sql_file.close()
|
||||||
|
|
||||||
|
db_conn_url = CONF.database.connection
|
||||||
|
db_conn_url = db_conn_url and db_conn_url.replace("mysql+pymysql", "mysql") or ''
|
||||||
|
engine = create_engine(db_conn_url, echo=False)
|
||||||
|
|
||||||
|
for exec_item in range(len(sql_queries)):
|
||||||
|
conn = engine.connect()
|
||||||
|
exec_script = conn.execute(sql_queries[exec_item])
|
||||||
|
conn.close()
|
@ -77,19 +77,13 @@ logging = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# DB configurations
|
||||||
|
db_url = config.db_connect
|
||||||
|
|
||||||
database = {
|
database = {
|
||||||
'host': config.db_host,
|
'connection_string': db_url.endswith('/orm') and db_url.replace("/orm", "/orm_fms_db") or (db_url + 'orm_fms_db')
|
||||||
'username': config.db_user,
|
|
||||||
'password': config.db_pass,
|
|
||||||
'db_name': 'orm_fms_db',
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
database['connection_string'] = 'mysql://{0}:{1}@{2}:3306/{3}'.format(database['username'],
|
|
||||||
database['password'],
|
|
||||||
database['host'],
|
|
||||||
database['db_name'])
|
|
||||||
|
|
||||||
# this table is for calculating default extra specs needed
|
# this table is for calculating default extra specs needed
|
||||||
extra_spec_needed_table = {
|
extra_spec_needed_table = {
|
||||||
"ns": {
|
"ns": {
|
||||||
@ -164,7 +158,7 @@ authentication = {
|
|||||||
"tenant_name": config.token_auth_tenant,
|
"tenant_name": config.token_auth_tenant,
|
||||||
"token_role": config.token_auth_user_role,
|
"token_role": config.token_auth_user_role,
|
||||||
# The Keystone version currently in use. Can be either "2.0" or "3"
|
# The Keystone version currently in use. Can be either "2.0" or "3"
|
||||||
"keystone_version": "2.0",
|
"keystone_version": config.token_auth_version,
|
||||||
"policy_file": config.fms['policy_file'],
|
"policy_file": config.fms['policy_file'],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,8 +56,12 @@ logging = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
verify = config.ssl_verify
|
verify = config.ssl_verify
|
||||||
|
|
||||||
|
# DB configurations
|
||||||
|
db_url = config.db_connect
|
||||||
|
|
||||||
database = {
|
database = {
|
||||||
'connection_string': config.db_url + 'orm'
|
'connection_string': db_url.endswith('/orm') or (db_url + 'orm')
|
||||||
}
|
}
|
||||||
# Custom Configurations must be in Python dictionary format::
|
# Custom Configurations must be in Python dictionary format::
|
||||||
#
|
#
|
||||||
|
@ -68,17 +68,13 @@ logging = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
database = {
|
# DB configurations
|
||||||
'host': config.db_host,
|
db_url = config.db_connect
|
||||||
'username': config.db_user,
|
|
||||||
'password': config.db_pass,
|
|
||||||
'db_name': 'orm_ims_db',
|
|
||||||
|
|
||||||
|
database = {
|
||||||
|
'connection_string': db_url.endswith('/orm') and db_url.replace("/orm", "/orm_ims_db") or (db_url + 'orm_ims_db')
|
||||||
}
|
}
|
||||||
database['connection_string'] = 'mysql://{0}:{1}@{2}:3306/{3}'.format(database['username'],
|
|
||||||
database['password'],
|
|
||||||
database['host'],
|
|
||||||
database['db_name'])
|
|
||||||
|
|
||||||
application_root = config.ims['base_url']
|
application_root = config.ims['base_url']
|
||||||
|
|
||||||
@ -114,6 +110,6 @@ authentication = {
|
|||||||
"rms_url": config.rms['base_url'],
|
"rms_url": config.rms['base_url'],
|
||||||
"tenant_name": config.token_auth_tenant,
|
"tenant_name": config.token_auth_tenant,
|
||||||
"token_role": config.token_auth_user_role,
|
"token_role": config.token_auth_user_role,
|
||||||
"keystone_version": "2.0",
|
"keystone_version": config.token_auth_version,
|
||||||
"policy_file": config.ims['policy_file']
|
"policy_file": config.ims['policy_file']
|
||||||
}
|
}
|
||||||
|
@ -92,8 +92,10 @@ region_options = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# DB configurations
|
# DB configurations
|
||||||
|
db_url = config.db_connect
|
||||||
|
|
||||||
database = {
|
database = {
|
||||||
'url': config.db_url + 'orm_rms_db?charset=utf8',
|
'url': db_url.endswith('/orm') and db_url.replace("/orm", "/orm_rms_db") or (db_url + 'orm_rms_db'),
|
||||||
'max_retries': 3,
|
'max_retries': 3,
|
||||||
'retries_interval': 10
|
'retries_interval': 10
|
||||||
}
|
}
|
||||||
@ -110,7 +112,7 @@ authentication = {
|
|||||||
"mech_pass": config.token_auth_pass,
|
"mech_pass": config.token_auth_pass,
|
||||||
"tenant_name": config.token_auth_tenant,
|
"tenant_name": config.token_auth_tenant,
|
||||||
# The Keystone version currently in use. Can be either "2.0" or "3"
|
# The Keystone version currently in use. Can be either "2.0" or "3"
|
||||||
"keystone_version": "2.0",
|
"keystone_version": config.token_auth_version,
|
||||||
"policy_file": config.rms['policy_file']
|
"policy_file": config.rms['policy_file']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,8 +12,10 @@ server = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# DB configurations
|
# DB configurations
|
||||||
|
db_url = config.db_connect
|
||||||
|
|
||||||
database = {
|
database = {
|
||||||
'url': config.db_url + 'orm_rds?charset=utf8'
|
'url': db_url.endswith('/orm') and db_url.replace("/orm", "/orm_rds") or (db_url + 'orm_rds')
|
||||||
}
|
}
|
||||||
|
|
||||||
sot = {
|
sot = {
|
||||||
@ -214,5 +216,5 @@ authentication = {
|
|||||||
"tenant_name": config.token_auth_tenant,
|
"tenant_name": config.token_auth_tenant,
|
||||||
"token_role": config.token_auth_user_role,
|
"token_role": config.token_auth_user_role,
|
||||||
# The Keystone version currently in use. Can be either "2.0" or "3"
|
# The Keystone version currently in use. Can be either "2.0" or "3"
|
||||||
"keystone_version": "3"
|
"keystone_version": config.token_auth_version
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user