Hack the python path
[multicloud/framework.git] / multivimbroker / multivimbroker / scripts / api.py
1 #    Licensed under the Apache License, Version 2.0 (the "License");
2 #    you may not use this file except in compliance with the License.
3 #    You may obtain a copy of the License at
4 #
5 #        http://www.apache.org/licenses/LICENSE-2.0
6 #
7 #    Unless required by applicable law or agreed to in writing, software
8 #    distributed under the License is distributed on an "AS IS" BASIS,
9 #    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 #    See the License for the specific language governing permissions and
11 #    limitations under the License.
12 import eventlet
13 eventlet.monkey_patch()
14
15 import os # noqa
16 from oslo_config import cfg # noqa
17 from oslo_service import service # noqa
18 import sys # noqa
19 # FIXME: Since there is no explicitly setup process for the project. Hack the
20 # python here.
21 sys.path.append(os.path.abspath('.'))
22
23 from multivimbroker.api_v2 import service as api_service # noqa
24
25
26 def main():
27     try:
28         api_server = api_service.WSGIService()
29         launcher = service.launch(cfg.CONF,
30                                   api_server,
31                                   workers=api_server.workers)
32         launcher.wait()
33     except RuntimeError as excp:
34         sys.stderr.write("ERROR: %s\n" % excp)
35         sys.exit(1)
36
37
38 if __name__ == '__main__':
39     main()