blob: a78cfe7fc86ebc7a67cce8ea9c041f14e6e5e6bf [file] [log] [blame]
Tony Mack71592a52013-03-28 20:17:47 -04001#!/usr/bin/env python
2import os
3import sys
Tony Mack745bf6e2013-04-17 11:06:35 -04004import threading
Tony Mack71592a52013-03-28 20:17:47 -04005
Tony Mack2ff86222013-05-10 16:54:14 -04006os.environ.setdefault("DJANGO_SETTINGS_MODULE", "planetstack.settings")
Siobhan Tully30fd4292013-05-10 08:59:56 -04007from planetstack.config import Config
8from openstack.sliveragent import SliverAgent
Tony Mack0553f282013-06-10 22:54:50 -04009from openstack.observer import OpenStackObserver
Tony Mack71592a52013-03-28 20:17:47 -040010
11if __name__ == '__main__':
12
Tony Mackcd6bf662013-04-30 18:20:27 -040013 # bootstrap envirnment
Tony Mack71592a52013-03-28 20:17:47 -040014 from django.core.management import ManagementUtility
15 config = Config()
Tony Macke02d7202013-03-29 11:23:56 -040016 url = "%s:%s" % (config.api_host, config.api_port)
Tony Mack71592a52013-03-28 20:17:47 -040017 args = [__file__, 'runserver', url]
Tony Mackcd6bf662013-04-30 18:20:27 -040018
Tony Mackcd6bf662013-04-30 18:20:27 -040019
20 # start the sliver agent thread
Tony Mack704c1b02013-04-17 10:45:45 -040021 sliver_agent = SliverAgent()
Tony Mack745bf6e2013-04-17 11:06:35 -040022 sliver_agent_thread = threading.Thread(target=sliver_agent.run)
23 sliver_agent_thread.start()
Tony Mackcd6bf662013-04-30 18:20:27 -040024
Tony Mack0553f282013-06-10 22:54:50 -040025 # start the openstack observer
26 observer = OpenStackObserver()
27 observer_thread = threading.Thread(target=observer.run)
28 observer_thread.start()
29
Tony Mackcd6bf662013-04-30 18:20:27 -040030 # start the server
31 server = ManagementUtility(args)
Tony Mack745bf6e2013-04-17 11:06:35 -040032 server.execute()