コード例 #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(
        'boson.openstack.common.notification.%s' %
        message['event_type'])
    getattr(logger, priority)(jsonutils.dumps(message))
コード例 #2
0
ファイル: context.py プロジェクト: akshat-kakkar/boson
#
#    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 copy

from boson.db import api as db_api
from boson.openstack.common.gettextutils import _
from boson.openstack.common import log as logging
from boson import utils


LOG = logging.getLogger(__name__)


def generate_request_id():
    """Generate a unique request ID."""

    return 'req-' + utils.generate_uuid()


class Context(object):
    """
    Security context and request information.

    Represents the user taking a given action within the system.
    """
コード例 #3
0
ファイル: api.py プロジェクト: rickyhai11/boson
#    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 uuid

from boson.openstack.common import cfg
from boson.openstack.common import context
from boson.openstack.common.gettextutils import _
from boson.openstack.common import importutils
from boson.openstack.common import jsonutils
from boson.openstack.common import log as logging
from boson.openstack.common import timeutils

LOG = logging.getLogger(__name__)

notifier_opts = [
    cfg.MultiStrOpt('notification_driver',
                    default=[],
                    deprecated_name='list_notifier_drivers',
                    help='Driver or drivers to handle sending notifications'),
    cfg.StrOpt('default_notification_level',
               default='INFO',
               help='Default notification level for outgoing notifications'),
    cfg.StrOpt('default_publisher_id',
               default='$host',
               help='Default publisher_id for outgoing notifications'),
]

CONF = cfg.CONF