Improved init script

Change-Id: I43d7a1ecde954bd572336bc1468c2a7bed94ff81
This commit is contained in:
aviau 2015-01-19 14:05:23 -05:00
parent 370cf182bb
commit 1e29bdb1e7

View File

@ -14,13 +14,20 @@
"""Script to initialize Surveil dependencies.""" """Script to initialize Surveil dependencies."""
# from keystoneclient.v2_0 import client as keystone_client
# from keystoneclient import session
# from novaclient.v1_1 import client as nova_client
from surveil.api import config from surveil.api import config
def main(): def main():
# Create a basic config in mongodb # Create a basic config in mongodb
mongo = config.app_hooks[0].mongo_connection mongo = config.app_hooks[0].mongo_connection
# Drop the current shinken config
mongo.drop_database('shinken') mongo.drop_database('shinken')
mongo_shinken = mongo.shinken mongo_shinken = mongo.shinken
mongo_hosts = mongo_shinken.hosts mongo_hosts = mongo_shinken.hosts
mongo_services = mongo_shinken.services mongo_services = mongo_shinken.services
@ -38,3 +45,37 @@ def main():
"notification_period": "24x7", "retry_interval": "3", "notification_period": "24x7", "retry_interval": "3",
"service_description": "check-surveil-api"} "service_description": "check-surveil-api"}
) )
# Make the inventory of the OpenStack install
# keystone = keystone_client.Client(
# username=os.environ['OS_USERNAME'],
# tenant_name=os.environ['OS_TENANT_NAME'],
# password=os.environ['OS_PASSWORD'],
# auth_url=os.environ['OS_AUTH_URL'],
# )
# endpoints = keystone.service_catalog.get_endpoints()
# sess = session.Session(auth=keystone)
# Compute
# if 'compute' in endpoints.keys():
# nova_urls = [endpoint['publicURL'] for
# endpoint in endpoints['compute']]
# TODO(aviau): add compute hosts to surveil
# Image
# if 'image' in endpoints.keys():
# image_urls = [endpoint['publicURL'] for
# endpoint in endpoints['image']]
# TODO(aviau): add image hosts to surveil
# volume
# if 'volume' in endpoints.keys():
# volume_urls = [endpoint['publicURL'] for
# endpoint in endpoints['volume']]
# TODO(aviau): add image hosts to surveil
# identity
# if 'identity' in endpoints.keys():
# identity_urls = [endpoint['publicURL'] for
# endpoint in endpoints['identity']]
# TODO(aviau): add identity hosts to surveil