Esempio 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('healing.openstack.common.notification.%s' %
                               message['event_type'])
    getattr(logger, priority)(jsonutils.dumps(message))
Esempio n. 2
0
from healing.handler_plugins import base

from healing import exceptions
from healing.openstack.common import log as logging
from healing import utils

LOG = logging.getLogger(__name__)


class Mistral(base.HandlerPluginBase):
    """Trigger mistral workflow.

    Data format in action_meta is:
    {"workflow": "name", "task": "task", "params": {"admin_pass": "******"}}
    """
    DESCRIPTION = "Run mistral workflow"
    NAME = "mistral"
    
    def _common_endpoints(self, ctx): 
        nova_url = utils.get_endpoint_url(ctx, 'compute')
        # remove project. should use urllib better..
        nova_url = "/".join(nova_url.split("/")[:-1])
        return {'nova_url': nova_url}
        
        
    def start(self, ctx, action, block=False):
        try:
            import mistralclient.api.client as client
            import mistralclient.api.executions as executions
        except:
            LOG.error("Mistral not installed")
Esempio n. 3
0
from healing import context
from healing import exceptions
from healing.actionexecutor import rpcapi as action_api
from healing.engine.alarms import manager as alarm_manager
from healing.engine.alarms import generic_alarms
from healing import manager
from healing.objects import alarm_track
from healing.openstack.common import excutils
from healing.openstack.common import importutils
from healing.openstack.common import jsonutils
from healing.openstack.common import log as logging
from healing.openstack.common import periodic_task
from healing import utils


LOG = logging.getLogger(__name__)

class TrackerManager(manager.Manager):
    target = messaging.Target(version='1.0')
    event_types_listen = set()

    def __init__(self, scheduler_driver=None, *args, **kwargs):
        super(TrackerManager, self).__init__(service_name='actiontracker',
                                               *args, **kwargs)
        self.action_api = action_api.ActionAPI()

    def warn(self, ctxt, publisher_id, event_type, payload, metadata):
        self._process_notification(ctxt, event_type, payload, metadata)

    def error(self, ctxt, publisher_id, event_type, payload, metadata):
        self._process_notification(ctxt, event_type, payload, metadata)