예제 #1
0
파일: broker.py 프로젝트: splice/gofer
 def connect(self):
     """
     Connect to the broker.
     @return: The AMQP connection object.
     @rtype: I{Connection}
     """
     self.__lock()
     try:
         if self.connection is None:
             url = self.url.simple()
             transport = self.url.transport
             log.info('connecting:\n%s', self)
             con = Connection(
                 url=url,
                 tcp_nodelay=True,
                 reconnect=True,
                 transport=transport)
             con.attach()
             log.info('{%s} connected to AMQP', self.id())
             self.connection = con
         else:
             con = self.connection
         return con
     finally:
         self.__unlock()
예제 #2
0
def migrate(*args, **kwargs):
    """
    Migrate qpid queues:
    - Ensure pulp.task is no longer *exclusive*.
    - Rename agent queues: consumer_id> => pulp.agent.<consumer_id>
    """
    transport = pulp_conf.get('messaging', 'transport')
    if transport != 'qpid':
        # not using qpid
        return

    if not QPID_MESSAGING_AVAILABLE:
        msg = _(
            'Migration 0009 did not run because the python package qpid.messaging is not '
            'installed. Pulp\'s Qpid client dependencies can be installed with the '
            '\"pulp-server-qpid\" package group. See the installation docs for more '
            'information. Alternatively, you may reconfigure Pulp to use RabbitMQ.'
        )
        _logger.error(msg)
        raise Exception(msg)

    if not QPIDTOOLLIBS_AVAILABLE:
        msg = _(
            'Migration 0009 did not run because the python package qpidtoollibs is not '
            'installed. Pulp\'s Qpid client dependencies can be installed with the '
            '\"pulp-server-qpid\" package group. See the installation docs for more '
            'information. Alternatively, you may reconfigure Pulp to use RabbitMQ.'
        )
        _logger.error(msg)
        raise Exception(msg)

    url = urlparse(pulp_conf.get('messaging', 'url'))
    connection = Connection(host=url.hostname,
                            port=url.port,
                            transport=url.scheme,
                            reconnect=False,
                            ssl_certfile=pulp_conf.get('messaging',
                                                       'clientcert'),
                            ssl_skip_hostname_check=True)

    connection.attach()
    broker = BrokerAgent(connection)
    _migrate_reply_queue(broker)
    _migrate_agent_queues(broker)
    connection.detach()
예제 #3
0
def migrate(*args, **kwargs):
    """
    Migrate qpid queues:
    - Ensure pulp.task is no longer *exclusive*.
    - Rename agent queues: consumer_id> => pulp.agent.<consumer_id>
    """
    transport = pulp_conf.get('messaging', 'transport')
    if transport != 'qpid':
        # not using qpid
        return

    if not QPID_MESSAGING_AVAILABLE:
        msg = _(
            'Migration 0009 did not run because the python package qpid.messaging is not '
            'installed. Please install qpid.messaging and rerun the migrations. See %s'
            'for more information.')
        msg = msg % QPID_MESSAGING_URL
        _logger.error(msg)
        raise Exception(msg)

    if not QPIDTOOLLIBS_AVAILABLE:
        msg = _(
            'Migration 0009 did not run because the python package qpidtoollibs is not '
            'installed. Please install qpidtoollibs and rerun the migrations. See %s for more '
            'information.')
        msg = msg % QPIDTOOLLIBS_URL
        _logger.error(msg)
        raise Exception(msg)

    url = urlparse(pulp_conf.get('messaging', 'url'))
    connection = Connection(host=url.hostname,
                            port=url.port,
                            transport=url.scheme,
                            reconnect=False,
                            ssl_certfile=pulp_conf.get('messaging',
                                                       'clientcert'),
                            ssl_skip_hostname_check=True)

    connection.attach()
    broker = BrokerAgent(connection)
    _migrate_reply_queue(broker)
    _migrate_agent_queues(broker)
    connection.detach()
예제 #4
0
def migrate(*args, **kwargs):
    """
    Migrate qpid queues:
    - Ensure pulp.task is no longer *exclusive*.
    - Rename agent queues: consumer_id> => pulp.agent.<consumer_id>
    """
    transport = pulp_conf.get('messaging', 'transport')
    if transport != 'qpid':
        # not using qpid
        return

    if not QPID_MESSAGING_AVAILABLE:
        msg = _('Migration 0009 did not run because the python package qpid.messaging is not '
                'installed. Please install qpid.messaging and rerun the migrations. See %s'
                'for more information.')
        msg = msg % QPID_MESSAGING_URL
        _logger.error(msg)
        raise Exception(msg)

    if not QPIDTOOLLIBS_AVAILABLE:
        msg = _('Migration 0009 did not run because the python package qpidtoollibs is not '
                'installed. Please install qpidtoollibs and rerun the migrations. See %s for more '
                'information.')
        msg = msg % QPIDTOOLLIBS_URL
        _logger.error(msg)
        raise Exception(msg)

    url = urlparse(pulp_conf.get('messaging', 'url'))
    connection = Connection(
        host=url.hostname,
        port=url.port,
        transport=url.scheme,
        reconnect=False,
        ssl_certfile=pulp_conf.get('messaging', 'clientcert'),
        ssl_skip_hostname_check=True)

    connection.attach()
    broker = BrokerAgent(connection)
    _migrate_reply_queue(broker)
    _migrate_agent_queues(broker)
    connection.detach()
예제 #5
0
def migrate(*args, **kwargs):
    """
    Migrate qpid queues:
    - Ensure pulp.task is no longer *exclusive*.
    - Rename agent queues: consumer_id> => pulp.agent.<consumer_id>
    """
    transport = pulp_conf.get('messaging', 'transport')
    if transport != 'qpid':
        # not using qpid
        return

    if not QPID_MESSAGING_AVAILABLE:
        msg = _('Migration 0009 did not run because the python package qpid.messaging is not '
                'installed. Pulp\'s Qpid client dependencies can be installed with the '
                '\"pulp-server-qpid\" package group. See the installation docs for more '
                'information. Alternatively, you may reconfigure Pulp to use RabbitMQ.')
        _logger.error(msg)
        raise Exception(msg)

    if not QPIDTOOLLIBS_AVAILABLE:
        msg = _('Migration 0009 did not run because the python package qpidtoollibs is not '
                'installed. Pulp\'s Qpid client dependencies can be installed with the '
                '\"pulp-server-qpid\" package group. See the installation docs for more '
                'information. Alternatively, you may reconfigure Pulp to use RabbitMQ.')
        _logger.error(msg)
        raise Exception(msg)

    url = urlparse(pulp_conf.get('messaging', 'url'))
    connection = Connection(
        host=url.hostname,
        port=url.port,
        transport=url.scheme,
        reconnect=False,
        ssl_certfile=pulp_conf.get('messaging', 'clientcert'),
        ssl_skip_hostname_check=True)

    connection.attach()
    broker = BrokerAgent(connection)
    _migrate_reply_queue(broker)
    _migrate_agent_queues(broker)
    connection.detach()