Ranger Changes -
1. add database drop script 2. fix uuidgen config 3. fix logic to reset rangeragent version to 1.0 4. rename ranger services in start_services.sh script Change-Id: Ib9bddaa0385295c3bdea0b3eed942d6b0f71cb59
This commit is contained in:
parent
759b35b6be
commit
eceb24ee5c
@ -1,53 +1,58 @@
|
|||||||
[DEFAULT]
|
[DEFAULT]
|
||||||
protocol =
|
protocol = 'http'
|
||||||
orm_host =
|
orm_host = '127.0.0.1'
|
||||||
ranger_base =
|
ranger_url = 'http://127.0.0.1'
|
||||||
ssl_verify =
|
ranger_base = '/opt/stack/ranger'
|
||||||
log_location =
|
ssl_verify = False
|
||||||
|
ranger_agent_https_enabled = False
|
||||||
|
ranger_agent_client_cert_path = ''
|
||||||
|
log_location = '/var/log/ranger/'
|
||||||
|
|
||||||
[keystone_authtoken]
|
[keystone_authtoken]
|
||||||
username =
|
username = 'admin'
|
||||||
password =
|
password = 'password'
|
||||||
project_name =
|
project_name = 'admin'
|
||||||
region =
|
region = 'RegionOne'
|
||||||
project_domain_name =
|
project_domain_name = 'default'
|
||||||
user_domain_name =
|
user_domain_name = 'default'
|
||||||
|
## version may be '2.0' or '3' ('3' by default)
|
||||||
|
version = '2.0'
|
||||||
|
auth_enabled = False
|
||||||
|
|
||||||
[database]
|
[database]
|
||||||
connection =
|
connection = 'mysql://user:pass@localhost:3306/'
|
||||||
max_retries =
|
max_retries = 3
|
||||||
|
user_role = 'admin'
|
||||||
|
|
||||||
[uuid]
|
[uuid]
|
||||||
port =
|
port = 7001
|
||||||
log =
|
log = 'uuid.log'
|
||||||
|
|
||||||
[cms]
|
[cms]
|
||||||
port =
|
port = 7080
|
||||||
log =
|
log ='cms.log'
|
||||||
|
|
||||||
[fms]
|
[fms]
|
||||||
port =
|
port = 8082
|
||||||
log =
|
log = 'fms.log'
|
||||||
|
|
||||||
[audit]
|
[audit]
|
||||||
port =
|
port = 7002
|
||||||
log =
|
log = 'audit.log'
|
||||||
|
|
||||||
[ims]
|
[ims]
|
||||||
port =
|
port = 8084
|
||||||
log =
|
log = 'ims.log'
|
||||||
|
|
||||||
[rms]
|
[rms]
|
||||||
port =
|
port = 7003
|
||||||
log =
|
log = 'rms.log'
|
||||||
|
|
||||||
[rds]
|
[rds]
|
||||||
port =
|
port = 8777
|
||||||
repo_local_location =
|
repo_local_location = '/home/stack/orm_repo'
|
||||||
repo_remote_location =
|
repo_remote_location = 'git@127.0.0.1:/home/stack/orm_repo.git'
|
||||||
repo_user =
|
log = 'rdstest.log'
|
||||||
repo_email =
|
|
||||||
log =
|
|
||||||
|
|
||||||
[cli]
|
[cli]
|
||||||
base_region =
|
base_region = 'RegionOne'
|
||||||
|
@ -25,12 +25,21 @@ OrmOpts = [
|
|||||||
cfg.HostAddressOpt('orm_host',
|
cfg.HostAddressOpt('orm_host',
|
||||||
default='127.0.0.1',
|
default='127.0.0.1',
|
||||||
help='Orm server IP address.'),
|
help='Orm server IP address.'),
|
||||||
|
cfg.URIOpt('ranger_url',
|
||||||
|
default='http://127.0.0.1',
|
||||||
|
help='Ranger URL.'),
|
||||||
cfg.StrOpt('ranger_base',
|
cfg.StrOpt('ranger_base',
|
||||||
default='/opt/stack/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,
|
||||||
help='Flag for SSL verfiy Enabled/Disabled.'),
|
help='Flag for SSL verfiy Enabled/Disabled.'),
|
||||||
|
cfg.BoolOpt('ranger_agent_https_enabled',
|
||||||
|
default=False,
|
||||||
|
help='Ranger Agent https_enabled flag - True/False.'),
|
||||||
|
cfg.StrOpt('ranger_agent_client_cert_path',
|
||||||
|
default='',
|
||||||
|
help='Ranger Agent certificate path.'),
|
||||||
cfg.StrOpt('log_location',
|
cfg.StrOpt('log_location',
|
||||||
default='/var/log/ranger',
|
default='/var/log/ranger',
|
||||||
help='Orm log directory.'),
|
help='Orm log directory.'),
|
||||||
@ -239,6 +248,7 @@ CONF.register_opts(OrmCliGroup, orm_cli_group)
|
|||||||
debug_level = CONF.debug_level
|
debug_level = CONF.debug_level
|
||||||
protocol = CONF.protocol
|
protocol = CONF.protocol
|
||||||
orm_host = CONF.orm_host
|
orm_host = CONF.orm_host
|
||||||
|
ranger_url = CONF.ranger_url
|
||||||
ranger_base = CONF.ranger_base
|
ranger_base = CONF.ranger_base
|
||||||
ssl_verify = CONF.ssl_verify
|
ssl_verify = CONF.ssl_verify
|
||||||
token_auth_enabled = CONF.keystone_authtoken.auth_enabled
|
token_auth_enabled = CONF.keystone_authtoken.auth_enabled
|
||||||
@ -250,6 +260,8 @@ conn = CONF.database.connection
|
|||||||
db_connect = conn.replace("mysql+pymysql", "mysql") if conn else None
|
db_connect = conn.replace("mysql+pymysql", "mysql") if conn else None
|
||||||
# pass keystone version '2.0' or '3'
|
# pass keystone version '2.0' or '3'
|
||||||
token_auth_version = '3' if (CONF.keystone_authtoken.version == 'v3') else '2.0'
|
token_auth_version = '3' if (CONF.keystone_authtoken.version == 'v3') else '2.0'
|
||||||
|
cert_path = CONF.ranger_agent_client_cert_path
|
||||||
|
https_enabled = CONF.ranger_agent_https_enabled
|
||||||
|
|
||||||
|
|
||||||
uuid = {'port': CONF.uuid.port,
|
uuid = {'port': CONF.uuid.port,
|
||||||
|
21
orm/cmd/db_drop.py
Normal file
21
orm/cmd/db_drop.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.
|
||||||
|
|
||||||
|
from orm.services import db_cleanup
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
db_cleanup.main()
|
@ -5,6 +5,6 @@ import orm.base_config as config
|
|||||||
tenant_name = config.token_auth_tenant
|
tenant_name = config.token_auth_tenant
|
||||||
username = config.token_auth_user
|
username = config.token_auth_user
|
||||||
password = config.token_auth_pass
|
password = config.token_auth_pass
|
||||||
auth_region = config.cli['base_region']
|
auth_region = config.token_auth_version
|
||||||
orm_base_url = '{}://{}'.format(config.protocol, config.orm_host)
|
orm_base_url = config.ranger_url
|
||||||
verify = config.ssl_verify
|
verify = config.ssl_verify
|
||||||
|
60
orm/services/db_cleanup.py
Normal file
60
orm/services/db_cleanup.py
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
#!/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)
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
drop_db_stmt = "SET sql_notes = 0;" \
|
||||||
|
"DROP database orm;" \
|
||||||
|
"DROP database orm_audit;" \
|
||||||
|
"DROP database orm_cms_db;" \
|
||||||
|
"DROP database orm_fms_db;" \
|
||||||
|
"DROP database orm_rds;" \
|
||||||
|
"DROP database orm_rms_db;" \
|
||||||
|
"DROP database orm_uuidgen;"
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
conn = engine.connect()
|
||||||
|
exec_script = conn.execute(drop_db_stmt)
|
||||||
|
conn.close()
|
@ -58,10 +58,8 @@ logging = {
|
|||||||
verify = config.ssl_verify
|
verify = config.ssl_verify
|
||||||
|
|
||||||
# DB configurations
|
# DB configurations
|
||||||
db_url = config.db_connect
|
|
||||||
|
|
||||||
database = {
|
database = {
|
||||||
'connection_string': db_url.endswith('/orm') or (db_url + 'orm')
|
'connection_string': config.db_connect
|
||||||
}
|
}
|
||||||
# Custom Configurations must be in Python dictionary format::
|
# Custom Configurations must be in Python dictionary format::
|
||||||
#
|
#
|
||||||
|
@ -67,9 +67,9 @@ ordupdate = {
|
|||||||
'discovery_port': config.rms['port'],
|
'discovery_port': config.rms['port'],
|
||||||
'template_type': 'hot',
|
'template_type': 'hot',
|
||||||
# This flag should be false only in case the ord does not support https.
|
# This flag should be false only in case the ord does not support https.
|
||||||
'https_enabled': False,
|
'https_enabled': config.https_enabled,
|
||||||
# ORD supports HTTPS and you don't need a certificate? set 'cert_path': ''
|
# ORD supports HTTPS and you don't need a certificate? set 'cert_path': ''
|
||||||
'cert_path': ''
|
'cert_path': config.cert_path
|
||||||
}
|
}
|
||||||
|
|
||||||
UUID_URL = config.uuid['base_url'] + 'v1/uuids'
|
UUID_URL = config.uuid['base_url'] + 'v1/uuids'
|
||||||
@ -99,17 +99,12 @@ yaml_configs = {
|
|||||||
'subnets': 'subnet'
|
'subnets': 'subnet'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'cms_template_version': {
|
'cms_quota': {
|
||||||
'resource_v1': {
|
'resource_quotas': {
|
||||||
'ranger_agent_version': 3.0,
|
'quota_supported_params': ['vips', 'members', 'pools',
|
||||||
'quota_unsupported_params': ['vips', 'members', 'pools',
|
'nat_instance', 'route_table',
|
||||||
'nat_instance', 'route_table',
|
'health_monitors', 'loadbalancer',
|
||||||
'health_monitors', 'loadbalancer',
|
'listener']
|
||||||
'listener']
|
|
||||||
},
|
|
||||||
'resource_v2': {
|
|
||||||
'ranger_agent_version': 3.6,
|
|
||||||
'quota_unsupported_params': []
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -158,9 +153,9 @@ region_resource_id_status = {
|
|||||||
},
|
},
|
||||||
'allowed_ranger_agent_resource_version':
|
'allowed_ranger_agent_resource_version':
|
||||||
{
|
{
|
||||||
'customer': '3.0',
|
'customer': '1.0',
|
||||||
'image': '3.0',
|
'image': '1.0',
|
||||||
'flavor': '3.0'
|
'flavor': '1.0'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,10 +149,7 @@ def yamlbuilder(alldata, region):
|
|||||||
|
|
||||||
class CMSAdjustResource(object):
|
class CMSAdjustResource(object):
|
||||||
def __init__(self, rangerAgentVersion):
|
def __init__(self, rangerAgentVersion):
|
||||||
if rangerAgentVersion >= conf.yaml_configs.customer_yaml.cms_template_version.resource_v2.ranger_agent_version:
|
self.adjust_quota_parameters = CMSAdjustQuotaResource().adjust_quota_parameters
|
||||||
self.adjust_quota_parameters = CMSAdjustResourceV2().adjust_quota_parameters
|
|
||||||
else:
|
|
||||||
self.adjust_quota_parameters = CMSAdjustResourceV1().adjust_quota_parameters
|
|
||||||
|
|
||||||
def fix_quota_resource_item(self, uuid, quotas, resources, options):
|
def fix_quota_resource_item(self, uuid, quotas, resources, options):
|
||||||
if conf.yaml_configs.customer_yaml.yaml_options.quotas:
|
if conf.yaml_configs.customer_yaml.yaml_options.quotas:
|
||||||
@ -175,23 +172,11 @@ class CMSAdjustResource(object):
|
|||||||
{"type": options[item][1], "properties": items[item]}
|
{"type": options[item][1], "properties": items[item]}
|
||||||
|
|
||||||
|
|
||||||
class CMSAdjustResourceV1(object):
|
class CMSAdjustQuotaResource(object):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.unsupported_params = conf.yaml_configs.customer_yaml.cms_template_version.resource_v1.quota_unsupported_params
|
self.supported_new_params = conf.yaml_configs.customer_yaml.cms_quota.resource_quotas.quota_supported_params
|
||||||
|
|
||||||
def adjust_quota_parameters(self, key, item):
|
|
||||||
if key in self.unsupported_params:
|
|
||||||
del item[key]
|
|
||||||
logger.warning("Region does not support Quota Parameter {}."
|
|
||||||
" removed from resource".format(key))
|
|
||||||
|
|
||||||
|
|
||||||
class CMSAdjustResourceV2(object):
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
self.supported_new_params = conf.yaml_configs.customer_yaml.cms_template_version.resource_v1.quota_unsupported_params
|
|
||||||
|
|
||||||
def adjust_quota_parameters(self, key, item):
|
def adjust_quota_parameters(self, key, item):
|
||||||
if key in self.supported_new_params:
|
if key in self.supported_new_params:
|
||||||
logger.debug("New quota Parameter {} is added to quota resource".format(key))
|
logger.debug("New quota parameter {} is added to quota resource".format(key))
|
||||||
|
@ -4,31 +4,31 @@ set -e
|
|||||||
|
|
||||||
echo "Starting the audit service"
|
echo "Starting the audit service"
|
||||||
|
|
||||||
nohup orm-audit > /dev/null 2>&1&
|
nohup ranger-audit > /dev/null 2>&1&
|
||||||
|
|
||||||
echo "Starting the uuidgen service"
|
echo "Starting the uuidgen service"
|
||||||
|
|
||||||
nohup orm-uuidgen > /dev/null 2>&1&
|
nohup ranger-uuidgen > /dev/null 2>&1&
|
||||||
|
|
||||||
echo "Starting the rds service"
|
echo "Starting the rds service"
|
||||||
|
|
||||||
nohup orm-rds > /dev/null 2>&1&
|
nohup ranger-rds > /dev/null 2>&1&
|
||||||
|
|
||||||
echo "Starting the rms service"
|
echo "Starting the rms service"
|
||||||
|
|
||||||
nohup orm-rms > /dev/null 2>&1&
|
nohup ranger-rms > /dev/null 2>&1&
|
||||||
|
|
||||||
echo "Starting the cms service"
|
echo "Starting the cms service"
|
||||||
|
|
||||||
nohup orm-cms > /dev/null 2>&1&
|
nohup ranger-cms > /dev/null 2>&1&
|
||||||
|
|
||||||
echo "Starting the ims service"
|
echo "Starting the ims service"
|
||||||
|
|
||||||
nohup orm-ims > /dev/null 2>&1&
|
nohup ranger-ims > /dev/null 2>&1&
|
||||||
|
|
||||||
|
|
||||||
echo "Starting the fms service"
|
echo "Starting the fms service"
|
||||||
|
|
||||||
nohup orm-fms > /dev/null 2>&1&
|
nohup ranger-fms > /dev/null 2>&1&
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user