Exemple #1
0
    def _create_generic_connection(self,
                                   msg,
                                   needs_roundtrip=False,
                                   skip=None,
                                   raise_exc=True):

        # This roundtrip is needed to re-format msg in the format the underlying .from_bunch expects
        # in case this is a broker message rather than a startup one.
        if needs_roundtrip:
            conn = GenericConnection.from_dict(msg, skip)
            msg = conn.to_sql_dict(True)

        item = GenericConnection.from_bunch(msg)
        item_dict = item.to_dict(True)

        for key in msg:
            if key not in item_dict:
                if key != 'action':
                    item_dict[key] = msg[key]

        item_dict.queue_build_cap = self.server.fs_server_config.misc.queue_build_cap
        item_dict.auth_url = msg.address

        # Normalize the contents of the configuration message
        self.generic_normalize_config(item_dict)

        config_attr = self.generic_conn_api[item.type_]
        wrapper = self._generic_conn_handler[item.type_]

        config_attr[msg.name] = item_dict
        config_attr[msg.name].conn = wrapper(item_dict, self.server)
        config_attr[msg.name].conn.build_wrapper()
Exemple #2
0
    def _create_generic_connection(self, msg, needs_roundtrip=False, skip=None):

        # This roundtrip is needed to re-format msg in the format the underlying .from_bunch expects
        # in case this is a broker message rather than a startup one.
        if needs_roundtrip:
            conn = GenericConnection.from_dict(msg, skip)
            msg = conn.to_sql_dict(True)

        item = GenericConnection.from_bunch(msg)
        item_dict = item.to_dict(True)

        item_dict.queue_build_cap = self.server.fs_server_config.misc.queue_build_cap
        item_dict.auth_url = msg.address

        config_attr = self.generic_conn_api[item.type_]
        wrapper = self._generic_conn_handler[item.type_]

        config_attr[msg.name] = item_dict
        config_attr[msg.name].conn = wrapper(item_dict, self.server)
        config_attr[msg.name].conn.build_queue()