Beispiel #1
0
    def on_before_hello(self, message):
        try:
            rabbit_version = software.rabbitmq_software_info()
        except:
            raise HandlerError("Can't find rabbitmq on this server.")

        if rabbit_version.version < (2, 7, 0):
            self._logger.error("Unsupported RabbitMQ version. Assertion failed: %s >= 2.7.0",
                                            '.'.join(rabbit_version.version))
            sys.exit(1)
Beispiel #2
0
    def on_before_hello(self, message):
        try:
            rabbit_version = software.rabbitmq_software_info()
        except:
            raise HandlerError("Can't find rabbitmq on this server.")

        if rabbit_version.version < (2, 7, 0):
            self._logger.error("Unsupported RabbitMQ version. Assertion failed: %s >= 2.7.0",
                                            '.'.join(rabbit_version.version))
            sys.exit(1)
Beispiel #3
0
    def __init__(self):
        self._logger = logging.getLogger(__name__)
        try:
            self.version = software.rabbitmq_software_info().version
        except:
            self._logger.error("Can't install RabbitMQ")
            raise

        for dirname in os.listdir('/usr/lib/rabbitmq/lib/'):
            if dirname.startswith('rabbitmq_server'):
                self.plugin_dir = os.path.join('/usr/lib/rabbitmq/lib/',
                                               dirname, 'plugins')
                break
        else:
            raise Exception('RabbitMQ plugin directory not found')

        self.service = initdv2.lookup(SERVICE_NAME)
Beispiel #4
0
    def on_RabbitMq_SetupControlPanel(self, message):
        try:
            if not 'running' == __node__['state']:
                raise HandlerError('Server is not in RUNNING state yet')
            try:
                self.service.stop('enable plugin')
                self.rabbitmq.enable_plugin(RABBITMQ_MGMT_PLUGIN_NAME)
            finally:
                self.service.start()

            rabbit_version = software.rabbitmq_software_info()
            panel_port = 55672 if rabbit_version.version <= (3, 0, 0) else 15672

            msg_body = dict(status='ok', port=panel_port)
        except:
            error = str(sys.exc_info()[1])
            msg_body = dict(status='error', last_error=error)
        finally:
            self.send_message(RabbitMQMessages.RABBITMQ_SETUP_CONTROL_PANEL_RESULT, msg_body)
Beispiel #5
0
    def __init__(self):
        __rabbitmq__['rabbitmqctl'] = software.which('rabbitmqctl')
        __rabbitmq__['rabbitmq-server'] = software.which('rabbitmq-server')
        # RabbitMQ from Ubuntu repo puts rabbitmq-plugins in non-obvious place
        __rabbitmq__['rabbitmq-plugins'] = software.which(
            'rabbitmq-plugins', '/usr/lib/rabbitmq/bin/')

        self._logger = logging.getLogger(__name__)
        try:
            self.version = software.rabbitmq_software_info().version
        except:
            self._logger.error("Can't install RabbitMQ")
            raise

        for dirname in os.listdir('/usr/lib/rabbitmq/lib/'):
            if dirname.startswith('rabbitmq_server'):
                self.plugin_dir = os.path.join('/usr/lib/rabbitmq/lib/',
                                               dirname, 'plugins')
                break
        else:
            raise Exception('RabbitMQ plugin directory not found')

        self.service = initdv2.lookup(SERVICE_NAME)
Beispiel #6
0
RABBITMQCTL = software.which('rabbitmqctl')
RABBITMQ_SERVER = software.which('rabbitmq-server')


class NodeTypes:
    RAM = 'ram'
    DISK = 'disk'


# RabbitMQ from ubuntu repo puts rabbitmq-plugins
# binary in non-obvious place
RABBITMQ_PLUGINS = software.which('rabbitmq-plugins', '/usr/lib/rabbitmq/bin/')

try:
    RABBITMQ_VERSION = software.rabbitmq_software_info().version
except:
    RABBITMQ_VERSION = (0, 0, 0)


class RabbitMQInitScript(initdv2.ParametrizedInitScript):
    @lazy
    def __new__(cls, *args, **kws):
        obj = super(RabbitMQInitScript, cls).__new__(cls, *args, **kws)
        cls.__init__(obj)
        return obj

    def __init__(self):
        initdv2.ParametrizedInitScript.__init__(
            self,
            'rabbitmq',
Beispiel #7
0
NODE_HOSTNAME_TPL = 'rabbit@%s'
RABBIT_HOSTNAME_TPL = 'rabbit-%s'

RABBITMQCTL = software.which('rabbitmqctl')
RABBITMQ_SERVER = software.which('rabbitmq-server')

class NodeTypes:
    RAM = 'ram'
    DISK = 'disk'

# RabbitMQ from ubuntu repo puts rabbitmq-plugins
# binary in non-obvious place
RABBITMQ_PLUGINS = software.which('rabbitmq-plugins', '/usr/lib/rabbitmq/bin/')

try:
    RABBITMQ_VERSION = software.rabbitmq_software_info().version
except:
    RABBITMQ_VERSION = (0, 0, 0)


class RabbitMQInitScript(initdv2.ParametrizedInitScript):

    @lazy
    def __new__(cls, *args, **kws):
        obj = super(RabbitMQInitScript, cls).__new__(cls, *args, **kws)
        cls.__init__(obj)
        return obj

    def __init__(self):
        initdv2.ParametrizedInitScript.__init__(
                        self,