Exemplo n.º 1
0
def initialize_application():
    objects.register_all()
    CONF(sys.argv[1:], project='karbor', version=version.version_string())
    logging.setup(CONF, "karbor")

    rpc.init(CONF)
    return wsgi.Loader(CONF).load_app(name='osapi_karbor')
Exemplo n.º 2
0
def main():
    objects.register_all()
    CONF(sys.argv[1:], project='karbor', version=version.version_string())
    logging.setup(CONF, "karbor")
    server = service.Service.create(binary='karbor-protection')
    service.serve(server)
    service.wait()
Exemplo n.º 3
0
def main():
    objects.register_all()
    CONF(sys.argv[1:], project='karbor',
         version=version.version_string())
    logging.setup(CONF, "karbor")
    server = service.Service.create(binary='karbor-operationengine')
    service.serve(server)
    service.wait()
Exemplo n.º 4
0
def main():
    objects.register_all()
    CONF(sys.argv[1:], project='karbor', version=version.version_string())
    logging.setup(CONF, "karbor")

    rpc.init(CONF)
    launcher = service.get_launcher()
    server = service.WSGIService('osapi_karbor')
    launcher.launch_service(server, workers=server.workers)
    launcher.wait()
Exemplo n.º 5
0
def main():
    objects.register_all()
    CONF(sys.argv[1:], project='karbor',
         version=version.version_string())
    logging.setup(CONF, "karbor")

    rpc.init(CONF)
    launcher = service.get_launcher()
    server = service.WSGIService('osapi_karbor')
    launcher.launch_service(server, workers=server.workers)
    launcher.wait()
Exemplo n.º 6
0
def main():
    """Parse options and call the appropriate class/method."""
    objects.register_all()
    CONF.register_cli_opt(category_opt)
    script_name = sys.argv[0]
    if len(sys.argv) < 2:
        print(
            _("\nOpenStack Karbor version: %(version)s\n") %
            {'version': version.version_string()})
        print(script_name + " category action [<args>]")
        print(_("Available categories:"))
        for category in CATEGORIES:
            print(_("\t%s") % category)
        sys.exit(2)

    try:
        CONF(sys.argv[1:], project='karbor', version=version.version_string())
        logging.setup(CONF, "karbor")
    except cfg.ConfigDirNotFoundError as details:
        print(_("Invalid directory: %s") % details)
        sys.exit(2)
    except cfg.ConfigFilesNotFoundError:
        cfgfile = CONF.config_file[-1] if CONF.config_file else None
        if cfgfile and not os.access(cfgfile, os.R_OK):
            st = os.stat(cfgfile)
            print(
                _("Could not read %s, Please try running this"
                  "command again as root/Administrator privilege"
                  "using sudo.") % cfgfile)
            try:
                os.execvp('sudo', ['sudo', '-u', '#%s' % st.st_uid] + sys.argv)
            except Exception:
                print(_('sudo failed, continuing as if nothing happened'))

        print(_('Please re-run karbor-manage as root.'))
        sys.exit(2)

    fn = CONF.category.action_fn
    fn_args = fetch_func_args(fn)
    fn(*fn_args)
Exemplo n.º 7
0
def main():
    """Parse options and call the appropriate class/method."""
    objects.register_all()
    CONF.register_cli_opt(category_opt)
    script_name = sys.argv[0]
    if len(sys.argv) < 2:
        print(_("\nOpenStack Karbor version: %(version)s\n") %
              {'version': version.version_string()})
        print(script_name + " category action [<args>]")
        print(_("Available categories:"))
        for category in CATEGORIES:
            print(_("\t%s") % category)
        sys.exit(2)

    try:
        CONF(sys.argv[1:], project='karbor',
             version=version.version_string())
        logging.setup(CONF, "karbor")
    except cfg.ConfigDirNotFoundError as details:
        print(_("Invalid directory: %s") % details)
        sys.exit(2)
    except cfg.ConfigFilesNotFoundError:
        cfgfile = CONF.config_file[-1] if CONF.config_file else None
        if cfgfile and not os.access(cfgfile, os.R_OK):
            st = os.stat(cfgfile)
            print(_("Could not read %s, Please try running this"
                    "command again as root/Administrator privilege"
                    "using sudo.") % cfgfile)
            try:
                os.execvp('sudo', ['sudo', '-u', '#%s' % st.st_uid] + sys.argv)
            except Exception:
                print(_('sudo failed, continuing as if nothing happened'))

        print(_('Please re-run karbor-manage as root.'))
        sys.exit(2)

    fn = CONF.category.action_fn
    fn_args = fetch_func_args(fn)
    fn(*fn_args)
Exemplo n.º 8
0
#    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 eventlet

from karbor import objects

eventlet.monkey_patch()
objects.register_all()