示例#1
0
def notify(_context, message):
    """Notifies the recipient of the desired event given the model.

    Log notifications using OpenStack's default logging system.
    """

    priority = message.get('priority',
                           CONF.default_notification_level)
    priority = priority.lower()
    logger = logging.getLogger(
        'muranorepository.openstack.common.notification.%s' %
        message['event_type'])
    getattr(logger, priority)(jsonutils.dumps(message))
示例#2
0
# /usr/(local/)lib/python...
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(__file__),
                                                os.pardir,
                                                os.pardir,
                                                os.pardir))
if os.path.exists(os.path.join(possible_topdir,
                                'muranorepository',
                                '__init__.py')):
    sys.path.insert(0, possible_topdir)

from muranorepository import config
import muranorepository.main as server
from muranorepository.openstack.common import log


LOG = log.getLogger(__name__)


def main():
    dev_conf = os.path.join(possible_topdir,
                            'etc',
                            'muranorepository.conf')
    config_files = None
    if os.path.exists(dev_conf):
        config_files = [dev_conf]

    config.parse_configs(sys.argv[1:], config_files)

    log.setup('muranorepository')

    app = server.make_app()