• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python _i18n._LI函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中neutron_lbaas._i18n._LI函数的典型用法代码示例。如果您正苦于以下问题:Python _LI函数的具体用法?Python _LI怎么用?Python _LI使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了_LI函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: login

    def login(self):
        """Get session based login"""
        login_obj = {"username": self.username, "password": self.password}

        msg = "NetScaler driver login:" + repr(login_obj)
        LOG.info(msg)
        resp_status, result = self.create_resource("login", NITRO_LOGIN_URI,
                                                   "login", login_obj)
        LOG.info(_LI("Response: status : %(status)s %result(result)s"), {
                 "status": resp_status, "result": result['body']})
        result_body = jsonutils.loads(result['body'])

        session_id = None
        if result_body and "login" in result_body:
            logins = result_body["login"]
            if isinstance(logins, list):
                login = logins[0]
            else:
                login = logins
            if login and "sessionid" in login:
                session_id = login["sessionid"]

        if session_id:
            LOG.info(_LI("Response: %(result)s"), {"result": result['body']})
            LOG.info(
                _LI("Session_id = %(session_id)s") %
                {"session_id": session_id})
            # Update sessin_id in auth
            self.auth = "SessId=%s" % session_id
        else:
            raise NCCException(NCCException.RESPONSE_ERROR)
开发者ID:TonyChengTW,项目名称:OpenStack_Liberty_Control,代码行数:31,代码来源:ncc_client.py


示例2: stop

 def stop(self, graceful=False):
     if self.server:
         LOG.info(_LI('Stopping consumer...'))
         self.server.stop()
         if graceful:
             LOG.info(
                 _LI('Consumer successfully stopped.  Waiting for final '
                     'messages to be processed...'))
             self.server.wait()
     super(OctaviaConsumer, self).stop(graceful=graceful)
开发者ID:Stef1010,项目名称:neutron-lbaas,代码行数:10,代码来源:octavia_messaging_consumer.py


示例3: _create_snatport_for_subnet_if_not_exists

 def _create_snatport_for_subnet_if_not_exists(self, context, tenant_id,
                                               subnet_id, network_info):
     port = self._get_snatport_for_subnet(context, tenant_id, subnet_id)
     if not port:
         LOG.info(_LI("No SNAT port found for subnet %s. Creating one..."),
                  subnet_id)
         port = self._create_snatport_for_subnet(context, tenant_id,
                                                 subnet_id,
                                                 ip_address=None)
     network_info['port_id'] = port['id']
     network_info['snat_ip'] = port['fixed_ips'][0]['ip_address']
     LOG.info(_LI("SNAT port: %r"), port)
开发者ID:Stef1010,项目名称:neutron-lbaas,代码行数:12,代码来源:netscaler_driver.py


示例4: agent_updated

 def agent_updated(self, context, payload):
     """Handle the agent_updated notification event."""
     if payload["admin_state_up"] != self.admin_state_up:
         self.admin_state_up = payload["admin_state_up"]
         if self.admin_state_up:
             self.needs_resync = True
         else:
             # Copy keys since the dictionary is modified in the loop body
             for loadbalancer_id in list(self.instance_mapping.keys()):
                 LOG.info(_LI("Destroying loadbalancer %s due to agent " "disabling"), loadbalancer_id)
                 self._destroy_loadbalancer(loadbalancer_id)
         LOG.info(_LI("Agent_updated by server side %s!"), payload)
开发者ID:F5Networks,项目名称:neutron-lbaas,代码行数:12,代码来源:agent_manager.py


示例5: agent_updated

 def agent_updated(self, context, payload):
     """Handle the agent_updated notification event."""
     if payload['admin_state_up'] != self.admin_state_up:
         self.admin_state_up = payload['admin_state_up']
         if self.admin_state_up:
             self.needs_resync = True
         else:
             for loadbalancer_id in self.instance_mapping.keys():
                 LOG.info(_LI("Destroying loadbalancer %s due to agent "
                              "disabling"), loadbalancer_id)
                 self._destroy_loadbalancer(loadbalancer_id)
         LOG.info(_LI("Agent_updated by server side %s!"), payload)
开发者ID:TonyChengTW,项目名称:OpenStack_Liberty_Control,代码行数:12,代码来源:agent_manager.py


示例6: agent_updated

 def agent_updated(self, context, payload):
     """Handle the agent_updated notification event."""
     if payload['admin_state_up'] != self.admin_state_up:
         self.admin_state_up = payload['admin_state_up']
         if self.admin_state_up:
             self.needs_resync = True
         else:
             # Copy keys because the dict is modified in the loop body
             for pool_id in list(self.instance_mapping.keys()):
                 LOG.info(_LI("Destroying pool %s due to agent disabling"),
                          pool_id)
                 self._destroy_pool(pool_id)
         LOG.info(_LI("Agent_updated by server side %s!"), payload)
开发者ID:F5Networks,项目名称:neutron-lbaas,代码行数:13,代码来源:agent_manager.py


示例7: start

 def start(self):
     super(OctaviaConsumer, self).start()
     LOG.info(_LI("Starting octavia consumer..."))
     self.server = messaging.get_rpc_server(self.transport, self.target,
                                            self.endpoints,
                                            executor='eventlet')
     self.server.start()
开发者ID:Stef1010,项目名称:neutron-lbaas,代码行数:7,代码来源:octavia_messaging_consumer.py


示例8: delete_cert

    def delete_cert(self, project_id, cert_ref, resource_ref, **kwargs):
        """Deletes the specified cert.

        :param project_id: Project ID for the owner of the certificate
        :param cert_ref: the UUID of the cert to delete
        :param resource_ref: Full HATEOAS reference to the consuming resource

        :raises CertificateStorageException: if certificate deletion fails
        """
        LOG.info(_LI(
            "Deleting certificate {0} from the local filesystem."
        ).format(cert_ref))

        filename_base = os.path.join(CONF.certificates.storage_path, cert_ref)

        filename_certificate = "{0}.crt".format(filename_base)
        filename_private_key = "{0}.key".format(filename_base)
        filename_intermediates = "{0}.int".format(filename_base)
        filename_pkp = "{0}.pass".format(filename_base)

        try:
            os.remove(filename_certificate)
            os.remove(filename_private_key)
            os.remove(filename_intermediates)
            os.remove(filename_pkp)
        except IOError as ioe:
            LOG.error(_LE(
                "Failed to delete certificate {0}."
            ).format(cert_ref))
            raise exceptions.CertificateStorageException(message=ioe.message)
开发者ID:F5Networks,项目名称:neutron-lbaas,代码行数:30,代码来源:local_cert_manager.py


示例9: _actually_delete_cert

    def _actually_delete_cert(cert_ref):
        """Deletes the specified cert. Very dangerous. Do not recommend.

        :param cert_ref: the UUID of the cert to delete
        :raises Exception: if certificate deletion fails
        """
        connection = BarbicanKeystoneAuth.get_barbican_client()

        LOG.info(_LI(
            "Recursively deleting certificate container {0} from Barbican."
        ).format(cert_ref))
        try:
            certificate_container = connection.containers.get(cert_ref)
            certificate_container.certificate.delete()
            if certificate_container.intermediates:
                certificate_container.intermediates.delete()
            if certificate_container.private_key_passphrase:
                certificate_container.private_key_passphrase.delete()
            certificate_container.private_key.delete()
            certificate_container.delete()
        except Exception:
            with excutils.save_and_reraise_exception():
                LOG.exception(_LE(
                    "Error recursively deleting certificate container {0}"
                ).format(cert_ref))
开发者ID:bdrich,项目名称:neutron-lbaas,代码行数:25,代码来源:barbican_cert_manager.py


示例10: delete_cert

    def delete_cert(cert_ref, lb_id, service_name='lbaas', **kwargs):
        """Deregister as a consumer for the specified cert.

        :param cert_ref: the UUID of the cert to retrieve
        :param service_name: Friendly name for the consuming service
        :param lb_id: Loadbalancer id for building resource consumer URL

        :raises Exception: if deregistration fails
        """
        connection = BarbicanKeystoneAuth.get_barbican_client()

        LOG.info(_LI(
            "Deregistering as a consumer of {0} in Barbican."
        ).format(cert_ref))
        try:
            connection.containers.remove_consumer(
                container_ref=cert_ref,
                name=service_name,
                url=CertManager._get_service_url(lb_id)
            )
        except Exception:
            with excutils.save_and_reraise_exception():
                LOG.exception(_LE(
                    "Error deregistering as a consumer of {0}"
                ).format(cert_ref))
开发者ID:bdrich,项目名称:neutron-lbaas,代码行数:25,代码来源:barbican_cert_manager.py


示例11: get_cert

    def get_cert(cert_ref, service_name='lbaas',
                 lb_id=None,
                 check_only=False, **kwargs):
        """Retrieves the specified cert and registers as a consumer.

        :param cert_ref: the UUID of the cert to retrieve
        :param service_name: Friendly name for the consuming service
        :param lb_id: Loadbalancer id for building resource consumer URL
        :param check_only: Read Certificate data without registering

        :returns: octavia.certificates.common.Cert representation of the
                 certificate data
        :raises Exception: if certificate retrieval fails
        """
        connection = BarbicanKeystoneAuth.get_barbican_client()

        LOG.info(_LI(
            "Loading certificate container {0} from Barbican."
        ).format(cert_ref))
        try:
            if check_only:
                cert_container = connection.containers.get(
                    container_ref=cert_ref
                )
            else:
                cert_container = connection.containers.register_consumer(
                    container_ref=cert_ref,
                    name=service_name,
                    url=CertManager._get_service_url(lb_id)
                )
            return Cert(cert_container)
        except Exception:
            with excutils.save_and_reraise_exception():
                LOG.exception(_LE("Error getting {0}").format(cert_ref))
开发者ID:bdrich,项目名称:neutron-lbaas,代码行数:34,代码来源:barbican_cert_manager.py


示例12: get_cert

    def get_cert(self, project_id, cert_ref, resource_ref,
                 check_only=False, service_name='lbaas'):
        """Retrieves the specified cert and registers as a consumer.

        :param cert_ref: the UUID of the cert to retrieve
        :param resource_ref: Full HATEOAS reference to the consuming resource
        :param check_only: Read Certificate data without registering
        :param service_name: Friendly name for the consuming service

        :returns: octavia.certificates.common.Cert representation of the
                 certificate data
        :raises Exception: if certificate retrieval fails
        """
        connection = self.auth.get_barbican_client(project_id)

        LOG.info(_LI(
            "Loading certificate container {0} from Barbican."
        ).format(cert_ref))
        try:
            if check_only:
                cert_container = connection.containers.get(
                    container_ref=cert_ref
                )
            else:
                cert_container = connection.containers.register_consumer(
                    container_ref=cert_ref,
                    name=service_name,
                    url=resource_ref
                )
            return Cert(cert_container)
        except Exception:
            with excutils.save_and_reraise_exception():
                LOG.exception(_LE("Error getting {0}").format(cert_ref))
开发者ID:F5Networks,项目名称:neutron-lbaas,代码行数:33,代码来源:barbican_cert_manager.py


示例13: get_cert

    def get_cert(self, project_id, cert_ref, resource_ref, **kwargs):
        """Retrieves the specified cert.

        :param project_id: Project ID for the owner of the certificate
        :param cert_ref: the UUID of the cert to retrieve
        :param resource_ref: Full HATEOAS reference to the consuming resource

        :returns: neutron_lbaas.common.cert_manager.cert_manager.Cert
                 representation of the certificate data
        :raises CertificateStorageException: if certificate retrieval fails
        """
        LOG.info(_LI(
            "Loading certificate {0} from the local filesystem."
        ).format(cert_ref))

        filename_base = os.path.join(CONF.certificates.storage_path, cert_ref)

        filename_certificate = "{0}.crt".format(filename_base)
        filename_private_key = "{0}.key".format(filename_base)
        filename_intermediates = "{0}.int".format(filename_base)
        filename_pkp = "{0}.pass".format(filename_base)

        cert_data = dict()

        try:
            with open(filename_certificate, 'r') as cert_file:
                cert_data['certificate'] = cert_file.read()
        except IOError:
            LOG.error(_LE(
                "Failed to read certificate for {0}."
            ).format(cert_ref))
            raise exceptions.CertificateStorageException(
                msg="Certificate could not be read."
            )
        try:
            with open(filename_private_key, 'r') as key_file:
                cert_data['private_key'] = key_file.read()
        except IOError:
            LOG.error(_LE(
                "Failed to read private key for {0}."
            ).format(cert_ref))
            raise exceptions.CertificateStorageException(
                msg="Private Key could not be read."
            )

        try:
            with open(filename_intermediates, 'r') as int_file:
                cert_data['intermediates'] = int_file.read()
        except IOError:
            pass

        try:
            with open(filename_pkp, 'r') as pass_file:
                cert_data['private_key_passphrase'] = pass_file.read()
        except IOError:
            pass

        return Cert(**cert_data)
开发者ID:F5Networks,项目名称:neutron-lbaas,代码行数:58,代码来源:local_cert_manager.py


示例14: _remove_snatport_for_subnet_if_not_used

 def _remove_snatport_for_subnet_if_not_used(self, context, tenant_id,
                                             subnet_id):
     pools = self._get_pools_on_subnet(context, tenant_id, subnet_id)
     if not pools:
         #No pools left on the old subnet.
         #We can remove the SNAT port/ipaddress
         self._remove_snatport_for_subnet(context, tenant_id, subnet_id)
         LOG.info(_LI("Removing SNAT port for subnet %s "
                      "as this is the last pool using it..."),
                  subnet_id)
开发者ID:Stef1010,项目名称:neutron-lbaas,代码行数:10,代码来源:netscaler_driver.py


示例15: _get_snatport_for_subnet

 def _get_snatport_for_subnet(self, context, tenant_id, subnet_id):
     device_id = '_lb-snatport-' + subnet_id
     subnet = self.plugin._core_plugin.get_subnet(context, subnet_id)
     network_id = subnet['network_id']
     LOG.debug("Filtering ports based on network_id=%(network_id)s, "
               "tenant_id=%(tenant_id)s, device_id=%(device_id)s",
               {'network_id': network_id,
                'tenant_id': tenant_id,
                'device_id': device_id})
     filter_dict = {
         'network_id': [network_id],
         'tenant_id': [tenant_id],
         'device_id': [device_id],
         'device-owner': [DRIVER_NAME]
     }
     ports = self.plugin._core_plugin.get_ports(context,
                                                filters=filter_dict)
     if ports:
         LOG.info(_LI("Found an existing SNAT port for subnet %s"),
                  subnet_id)
         return ports[0]
     LOG.info(_LI("Found no SNAT ports for subnet %s"), subnet_id)
开发者ID:Stef1010,项目名称:neutron-lbaas,代码行数:22,代码来源:netscaler_driver.py


示例16: deploy_instance

    def deploy_instance(self, loadbalancer):
        """Deploys loadbalancer if necessary

        :returns: True if loadbalancer was deployed, False otherwise
        """
        if not self.deployable(loadbalancer):
            LOG.info(_LI("Loadbalancer %s is not deployable.") % loadbalancer.id)
            return False

        if self.exists(loadbalancer.id):
            self.update(loadbalancer)
        else:
            self.create(loadbalancer)
        return True
开发者ID:bdrich,项目名称:neutron-lbaas,代码行数:14,代码来源:namespace_driver.py


示例17: _create_proxy_port

    def _create_proxy_port(self,
        ctx, lb, proxy_port_subnet_id):
        """Check if proxy port was created earlier.
        If not, create a new port on proxy subnet and return its ip address.
        Returns port IP address
        """
        proxy_port = self._get_proxy_port(ctx, lb)
        if proxy_port:
            LOG.info(_LI('LB %(lb_id)s proxy port exists on subnet \
                     %(subnet_id)s with ip address %(ip_address)s') %
                     {'lb_id': lb.id, 'subnet_id': proxy_port['subnet_id'],
                      'ip_address': proxy_port['ip_address']})
            return proxy_port

        proxy_port_name = 'proxy_' + lb.id
        proxy_port_subnet = self.plugin.db._core_plugin.get_subnet(
            ctx, proxy_port_subnet_id)
        proxy_port_data = {
            'tenant_id': lb.tenant_id,
            'name': proxy_port_name,
            'network_id': proxy_port_subnet['network_id'],
            'mac_address': attributes.ATTR_NOT_SPECIFIED,
            'admin_state_up': False,
            'device_id': '',
            'device_owner': 'neutron:' + constants.LOADBALANCERV2,
            'fixed_ips': [{'subnet_id': proxy_port_subnet_id}]
        }
        proxy_port = self.plugin.db._core_plugin.create_port(
            ctx, {'port': proxy_port_data})
        proxy_port_ip_data = proxy_port['fixed_ips'][0]

        LOG.info(_LI('LB %(lb_id)s proxy port created on subnet %(subnet_id)s \
                 with ip address %(ip_address)s') %
                 {'lb_id': lb.id, 'subnet_id': proxy_port_ip_data['subnet_id'],
                  'ip_address': proxy_port_ip_data['ip_address']})

        return proxy_port_ip_data
开发者ID:bdrich,项目名称:neutron-lbaas,代码行数:37,代码来源:v2_driver.py


示例18: create_member

 def create_member(self, context, member):
     """Create a pool member on a NetScaler device."""
     ncc_member = self._prepare_member_for_creation(member)
     LOG.info(_LI("NetScaler driver poolmember creation: %r"),
              ncc_member)
     status = constants.ACTIVE
     try:
         self.client.create_resource(context.tenant_id,
                                     POOLMEMBERS_RESOURCE,
                                     POOLMEMBER_RESOURCE,
                                     ncc_member)
     except ncc_client.NCCException:
         status = constants.ERROR
     self.plugin.update_status(context, loadbalancer_db.Member,
                               member["id"], status)
开发者ID:Stef1010,项目名称:neutron-lbaas,代码行数:15,代码来源:netscaler_driver.py


示例19: store_cert

    def store_cert(self, project_id, certificate, private_key,
                   intermediates=None, private_key_passphrase=None, **kwargs):
        """Stores (i.e., registers) a cert with the cert manager.

        This method stores the specified cert to the filesystem and returns
        a UUID that can be used to retrieve it.

        :param project_id: Project ID for the owner of the certificate
        :param certificate: PEM encoded TLS certificate
        :param private_key: private key for the supplied certificate
        :param intermediates: ordered and concatenated intermediate certs
        :param private_key_passphrase: optional passphrase for the supplied key

        :returns: the UUID of the stored cert
        :raises CertificateStorageException: if certificate storage fails
        """
        cert_ref = str(uuid.uuid4())
        filename_base = os.path.join(CONF.certificates.storage_path, cert_ref)

        LOG.info(_LI(
            "Storing certificate data on the local filesystem."
        ))
        try:
            filename_certificate = "{0}.crt".format(filename_base)
            with open(filename_certificate, 'w') as cert_file:
                cert_file.write(certificate)

            filename_private_key = "{0}.key".format(filename_base)
            with open(filename_private_key, 'w') as key_file:
                key_file.write(private_key)

            if intermediates:
                filename_intermediates = "{0}.int".format(filename_base)
                with open(filename_intermediates, 'w') as int_file:
                    int_file.write(intermediates)

            if private_key_passphrase:
                filename_pkp = "{0}.pass".format(filename_base)
                with open(filename_pkp, 'w') as pass_file:
                    pass_file.write(private_key_passphrase)
        except IOError as ioe:
            LOG.error(_LE("Failed to store certificate."))
            raise exceptions.CertificateStorageException(message=ioe.message)

        return cert_ref
开发者ID:F5Networks,项目名称:neutron-lbaas,代码行数:45,代码来源:local_cert_manager.py


示例20: _call_driver_operation

 def _call_driver_operation(self, context, driver_method, db_entity,
                            old_db_entity=None):
     manager_method = "%s.%s" % (driver_method.__self__.__class__.__name__,
                                 driver_method.__name__)
     LOG.info(_LI("Calling driver operation %s") % manager_method)
     try:
         if old_db_entity:
             driver_method(context, old_db_entity, db_entity)
         else:
             driver_method(context, db_entity)
     # catching and reraising agent issues
     except (lbaas_agentschedulerv2.NoEligibleLbaasAgent,
             lbaas_agentschedulerv2.NoActiveLbaasAgent) as no_agent:
         raise no_agent
     except Exception:
         LOG.exception(_LE("There was an error in the driver"))
         self._handle_driver_error(context, db_entity)
         raise loadbalancerv2.DriverError()
开发者ID:TonyChengTW,项目名称:OpenStack_Liberty_Control,代码行数:18,代码来源:plugin.py



注:本文中的neutron_lbaas._i18n._LI函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python _i18n._LW函数代码示例发布时间:2022-05-27
下一篇:
Python _i18n._LE函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap