Ejemplo n.º 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("ocas_utils.openstack.common.notification.%s" % message["event_type"])
    getattr(logger, priority)(jsonutils.dumps(message))
Ejemplo n.º 2
0
from sqlalchemy import Integer
from sqlalchemy import MetaData
from sqlalchemy.sql.expression import literal_column
from sqlalchemy.sql.expression import UpdateBase
from sqlalchemy.sql import select
from sqlalchemy import String
from sqlalchemy import Table
from sqlalchemy.types import NullType

from nscs.ocas_utils.openstack.common.gettextutils import _  # noqa

from nscs.ocas_utils.openstack.common import log as logging
from nscs.ocas_utils.openstack.common import timeutils


LOG = logging.getLogger(__name__)

_DBURL_REGEX = re.compile(r"[^:]+://([^:]+):([^@]+)@.+")


def sanitize_db_url(url):
    match = _DBURL_REGEX.match(url)
    if match:
        return '%s****:****%s' % (url[:match.start(1)], url[match.end(2):])
    return url


class InvalidSortKey(Exception):
    message = _("Sort key supplied was not valid.")