Cleanup Ranger config and db setup files
Change-Id: I756a24f2bb9365903ae221d60f23c5fdf74587bd
This commit is contained in:
parent
feb25dfd6f
commit
21f6bba340
@ -26,7 +26,7 @@ OrmOpts = [
|
|||||||
default='127.0.0.1',
|
default='127.0.0.1',
|
||||||
help='Orm server IP address.'),
|
help='Orm server IP address.'),
|
||||||
cfg.StrOpt('ranger_base',
|
cfg.StrOpt('ranger_base',
|
||||||
default='/opt/app/ranger',
|
default='/opt/stack/ranger',
|
||||||
help='Orm base directory.'),
|
help='Orm base directory.'),
|
||||||
cfg.BoolOpt('ssl_verify',
|
cfg.BoolOpt('ssl_verify',
|
||||||
default=False,
|
default=False,
|
||||||
@ -190,7 +190,7 @@ OrmRdsGroup = [
|
|||||||
default=8777,
|
default=8777,
|
||||||
help='Rds port.'),
|
help='Rds port.'),
|
||||||
cfg.StrOpt('repo_local_location',
|
cfg.StrOpt('repo_local_location',
|
||||||
default='/opt/app/git_repo',
|
default='/opt/stack/git_repo',
|
||||||
help='Path to repo location.'),
|
help='Path to repo location.'),
|
||||||
cfg.StrOpt('repo_remote_location',
|
cfg.StrOpt('repo_remote_location',
|
||||||
default='git@127.0.0.1:/home/repo/ORM.git',
|
default='git@127.0.0.1:/home/repo/ORM.git',
|
||||||
|
58
orm/cmd/db_setup.py
Normal file
58
orm/cmd/db_setup.py
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
#!/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'
|
21
orm/cmd/db_sync.py
Normal file
21
orm/cmd/db_sync.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# Copyright (c) 2018 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 db_setup
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
db_setup.main()
|
@ -1,3 +1,5 @@
|
|||||||
|
SET sql_notes=0;
|
||||||
|
|
||||||
create database if not exists orm_audit;
|
create database if not exists orm_audit;
|
||||||
|
|
||||||
use orm_audit;
|
use orm_audit;
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
SET sql_notes=0;
|
||||||
|
|
||||||
create database if not exists orm_cms_db DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
|
create database if not exists orm_cms_db DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
|
||||||
use orm_cms_db;
|
use orm_cms_db;
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
SET sql_notes=0;
|
||||||
|
|
||||||
USE orm_cms_db;
|
USE orm_cms_db;
|
||||||
DROP PROCEDURE IF EXISTS MoveKeyToQuota;
|
DROP PROCEDURE IF EXISTS MoveKeyToQuota;
|
||||||
DELIMITER ;;
|
DELIMITER ;;
|
||||||
@ -74,7 +76,7 @@ CALL MoveKeyToQuota('security_group_rules', 'network');
|
|||||||
SELECT "LIST OF ALL Security Items" as "";
|
SELECT "LIST OF ALL Security Items" as "";
|
||||||
SELECT "==========================" as "";
|
SELECT "==========================" as "";
|
||||||
SELECT q.*, qfd.* FROM quota_field_detail qfd
|
SELECT q.*, qfd.* FROM quota_field_detail qfd
|
||||||
left join quota q on (q.id = qfd.quota_id) where qfd.field_key like "security%";
|
left join quota q on (q.id = qfd.quota_id) where qfd.field_key like "security%%";
|
||||||
|
|
||||||
DELIMITER ;;
|
DELIMITER ;;
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
SET sql_notes=0;
|
||||||
|
|
||||||
create database if not exists orm_fms_db DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
|
create database if not exists orm_fms_db DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
|
||||||
use orm_fms_db;
|
use orm_fms_db;
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
SET sql_notes=0;
|
||||||
|
|
||||||
CREATE DATABASE if not exists orm;
|
CREATE DATABASE if not exists orm;
|
||||||
USE orm;
|
USE orm;
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
SET sql_notes=0;
|
||||||
|
|
||||||
create database if not exists orm_ims_db DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
|
create database if not exists orm_ims_db DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
|
||||||
use orm_ims_db;
|
use orm_ims_db;
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
SET sql_notes=0;
|
||||||
|
|
||||||
create database if not exists orm_rms_db DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
|
create database if not exists orm_rms_db DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
|
||||||
use orm_rms_db;
|
use orm_rms_db;
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
SET sql_notes=0;
|
||||||
|
|
||||||
create database if not exists orm_rds DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
|
create database if not exists orm_rds DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
|
||||||
use orm_rds;
|
use orm_rds;
|
||||||
|
|
||||||
|
15
setup.cfg
15
setup.cfg
@ -27,13 +27,14 @@ packages = orm
|
|||||||
|
|
||||||
[entry_points]
|
[entry_points]
|
||||||
console_scripts=
|
console_scripts=
|
||||||
orm-fms = orm.cmd.fms:main
|
ranger-fms = orm.cmd.fms:main
|
||||||
orm-cms = orm.cmd.cms:main
|
ranger-cms = orm.cmd.cms:main
|
||||||
orm-rms = orm.cmd.rms:main
|
ranger-rms = orm.cmd.rms:main
|
||||||
orm-rds = orm.cmd.rds:main
|
ranger-rds = orm.cmd.rds:main
|
||||||
orm-ims = orm.cmd.ims:main
|
ranger-ims = orm.cmd.ims:main
|
||||||
orm-audit = orm.cmd.audit:main
|
ranger-audit = orm.cmd.audit:main
|
||||||
orm-uuidgen = orm.cmd.uuidgen:main
|
ranger-uuidgen = orm.cmd.uuidgen:main
|
||||||
|
ranger-dbsync = orm.cmd.db_sync:main
|
||||||
oslo.config.opts =
|
oslo.config.opts =
|
||||||
ranger = orm.common.config:list_opts
|
ranger = orm.common.config:list_opts
|
||||||
|
|
||||||
|
4
setup.py
4
setup.py
@ -7,7 +7,7 @@ except ImportError:
|
|||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='orm',
|
name='ranger',
|
||||||
version='0.1',
|
version='0.1',
|
||||||
description='',
|
description='',
|
||||||
author='',
|
author='',
|
||||||
@ -15,7 +15,7 @@ setup(
|
|||||||
install_requires=[
|
install_requires=[
|
||||||
"pecan",
|
"pecan",
|
||||||
],
|
],
|
||||||
test_suite='orm',
|
test_suite='ranger',
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
|
Loading…
Reference in New Issue
Block a user