예제 #1
0
파일: utils.py 프로젝트: termie/nova
 def setup_flags(input_flags):
     """Initialize flags, load flag file, and print help if needed."""
     default_flagfile(args=input_flags)
     FLAGS(input_flags or [])
     flags.DEFINE_flag(flags.HelpFlag())
     flags.DEFINE_flag(flags.HelpshortFlag())
     flags.DEFINE_flag(flags.HelpXMLFlag())
     FLAGS.ParseNewFlags()
예제 #2
0
def wait():
    # After we've loaded up all our dynamic bits, check
    # whether we should print help
    flags.DEFINE_flag(flags.HelpFlag())
    flags.DEFINE_flag(flags.HelpshortFlag())
    flags.DEFINE_flag(flags.HelpXMLFlag())
    FLAGS.ParseNewFlags()
    logging.debug(_('Full set of FLAGS:'))
    for flag in FLAGS:
        flag_get = FLAGS.get(flag, None)
        logging.debug('%(flag)s : %(flag_get)s' % locals())
    try:
        _launcher.wait()
    except KeyboardInterrupt:
        _launcher.stop()
예제 #3
0
def serve_wsgi(cls, conf=None):
    try:
        service = cls.create(conf)
    except Exception:
        logging.exception('in WsgiService.create()')
        raise
    finally:
        # After we've loaded up all our dynamic bits, check
        # whether we should print help
        flags.DEFINE_flag(flags.HelpFlag())
        flags.DEFINE_flag(flags.HelpshortFlag())
        flags.DEFINE_flag(flags.HelpXMLFlag())
        FLAGS.ParseNewFlags()

    service.start()

    return service
예제 #4
0
def wait():
    # After we've loaded up all our dynamic bits, check
    # whether we should print help
    flags.DEFINE_flag(flags.HelpFlag())
    flags.DEFINE_flag(flags.HelpshortFlag())
    flags.DEFINE_flag(flags.HelpXMLFlag())
    FLAGS.ParseNewFlags()
    logging.debug(_('Full set of FLAGS:'))
    for flag in FLAGS:
        flag_get = FLAGS.get(flag, None)
        # hide flag contents from log if contains a password
        # should use secret flag when switch over to openstack-common
        if ("_password" in flag or "_key" in flag
                or (flag == "sql_connection" and "mysql:" in flag_get)):
            logging.debug('%(flag)s : FLAG SET ' % locals())
        else:
            logging.debug('%(flag)s : %(flag_get)s' % locals())
    try:
        _launcher.wait()
    except KeyboardInterrupt:
        _launcher.stop()
예제 #5
0
파일: service.py 프로젝트: cp16net/reddwarf
def serve(*services):
    try:
        if not services:
            services = [Service.create()]
    except Exception:
        logging.exception('in Service.create()')
        raise
    finally:
        # After we've loaded up all our dynamic bits, check
        # whether we should print help
        flags.DEFINE_flag(flags.HelpFlag())
        flags.DEFINE_flag(flags.HelpshortFlag())
        flags.DEFINE_flag(flags.HelpXMLFlag())
        FLAGS.ParseNewFlags()

    name = '_'.join(x.binary for x in services)
    logging.debug(_('Serving %s'), name)
    logging.debug(_('Full set of FLAGS:'))
    for flag in FLAGS:
        flag_get = FLAGS.get(flag, None)
        logging.debug('%(flag)s : %(flag_get)s' % locals())

    for x in services:
        x.start()
예제 #6
0
import optparse
import socket
import sys
import time

import wsproxy

from nova import flags
from nova import log as logging
from nova import rpc
from nova import utils

FLAGS = flags.FLAGS
flags.DEFINE_integer('vnc_proxy_idle_timeout', 180,
                     'Seconds before idle connection destroyed')
flags.DEFINE_flag(flags.HelpFlag())
flags.DEFINE_flag(flags.HelpshortFlag())
flags.DEFINE_flag(flags.HelpXMLFlag())


class NovaWebSocketProxy(wsproxy.WebSocketProxy):
    def __init__(self, *args, **kwargs):
        self.register_nova_listeners()
        wsproxy.WebSocketProxy.__init__(self, *args, **kwargs)

    def register_nova_listeners(self):
        self.tokens = {}

        class TopicProxy():
            @staticmethod
            def authorize_vnc_console(context, **kwargs):