当前位置: 首页>>代码示例>>Python>>正文


Python i18n._LI函数代码示例

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


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

示例1: show_checkpoint

    def show_checkpoint(self, context, provider_id, checkpoint_id):
        # TODO(wangliuan)
        LOG.info(_LI("Starting show checkpoints. "
                     "provider_id:%s"), provider_id)
        LOG.info(_LI("checkpoint_id:%s"), checkpoint_id)

        return_stub = {
            "id": "6f193601-39f8-4a81-993b-4d847393a0ee",
            "project_id": "446a04d8-6ff5-4e0e-99a4-827a6389e9ff",
            "status": "committed",
            "protection_plan": {
                "id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa398",
                "name": "My 3 tier application",
                "resources": [
                    {
                        "id": "64e51e85-4f31-441f-9a5d-6e93e3196628",
                        "type": "OS::Nova::Server",
                        "extended_info": {
                            "name": "VM1",
                            "backup status": "done",
                            "available_memory": 512
                        }
                    }
                ]
            },
            "provider_id": "cf56bd3e-97a7-4078-b6d5-f36246333fd9"
        }
        return return_stub
开发者ID:TommyLike,项目名称:smaug,代码行数:28,代码来源:manager.py

示例2: checkpoints_index

    def checkpoints_index(self, req, provider_id):
        """Returns a list of checkpoints, transformed through view builder."""
        context = req.environ['smaug.context']

        LOG.info(_LI("Show checkpoints list. "
                     "provider_id:%s"), provider_id)

        params = req.params.copy()
        marker, limit, offset = common.get_pagination_params(params)
        sort_keys, sort_dirs = common.get_sort_params(params)
        filters = params

        utils.remove_invalid_filter_options(
            context,
            filters,
            self._get_checkpoint_filter_options())

        utils.check_filters(filters)
        checkpoints = self._checkpoints_get_all(
            context, provider_id, marker, limit,
            sort_keys=sort_keys, sort_dirs=sort_dirs,
            filters=filters, offset=offset)

        retval_checkpoints = self._checkpoint_view_builder.detail_list(
            req, checkpoints)

        LOG.info(_LI("Show checkpoints list request issued successfully."))

        return retval_checkpoints
开发者ID:WeAreFormalGroup,项目名称:smaug,代码行数:29,代码来源:providers.py

示例3: index

    def index(self, req):
        """Returns a list of restores, transformed through view builder."""
        context = req.environ['smaug.context']

        LOG.info(_LI("Show restore list"), context=context)

        params = req.params.copy()
        marker, limit, offset = common.get_pagination_params(params)
        sort_keys, sort_dirs = common.get_sort_params(params)
        filters = params

        utils.remove_invalid_filter_options(
            context,
            filters,
            self._get_restore_filter_options())

        utils.check_filters(filters)
        restores = self._get_all(context, marker, limit,
                                 sort_keys=sort_keys,
                                 sort_dirs=sort_dirs,
                                 filters=filters,
                                 offset=offset)

        retval_restores = self._view_builder.detail_list(req, restores)

        LOG.info(_LI("Show restore list request issued successfully."))

        return retval_restores
开发者ID:Bloomie,项目名称:smaug,代码行数:28,代码来源:restores.py

示例4: show

    def show(self, req, id):
        """Return data about the given provider id."""
        context = req.environ['smaug.context']

        LOG.info(_LI("Show provider with id: %s"), id)

        try:
            provider = self._provider_get(context, id)
        except exception.ProviderNotFound as error:
            raise exc.HTTPNotFound(explanation=error.msg)

        LOG.info(_LI("Show provider request issued successfully."),
                 resource={'id': provider.get("id")})
        return self._view_builder.detail(req, provider)
开发者ID:WeAreFormalGroup,项目名称:smaug,代码行数:14,代码来源:providers.py

示例5: list_protectable_dependents

    def list_protectable_dependents(self, context,
                                    protectable_id,
                                    protectable_type):
        LOG.info(_LI("Start to list dependents of resource "
                     "(type:%(type)s, id:%(id)s)"),
                 {'type': protectable_type,
                  'id': protectable_id})

        parent_resource = Resource(type=protectable_type, id=protectable_id,
                                   name="")

        try:
            dependent_resources = \
                self.protectable_registry.fetch_dependent_resources(
                    context, parent_resource)
        except exception.ListProtectableResourceFailed as err:
            LOG.error(_LE("List dependent resources of (%(res)s) "
                          "failed: %(err)s"),
                      {'res': parent_resource,
                       'err': six.text_type(err)})
            raise

        result = []
        for resource in dependent_resources:
            result.append(dict(type=resource.type, id=resource.id,
                               name=resource.name))

        return result
开发者ID:Bloomie,项目名称:smaug,代码行数:28,代码来源:manager.py

示例6: list_checkpoints

    def list_checkpoints(self, context, provider_id, marker=None, limit=None,
                         sort_keys=None, sort_dirs=None, filters=None):
        LOG.info(_LI("Starting list checkpoints. "
                     "provider_id:%s"), provider_id)

        return_stub = [
            {
                "id": "2220f8b1-975d-4621-a872-fa9afb43cb6c",
                "project_id": "446a04d8-6ff5-4e0e-99a4-827a6389e9ff",
                "status": "comitted",
                "provider_id": "efc6a88b-9096-4bb6-8634-cda182a6e12a",
                "protection_plan": {
                    "id": "2a9ce1f3-cc1a-4516-9435-0ebb13caa398",
                    "name": "My 3 tier application",
                    "resources": [
                        {
                            "id": "64e51e85-4f31-441f-9a5d-6e93e3196628",
                            "type": "OS::Nova::Server"
                        },
                        {
                            "id": "61e51e85-4f31-441f-9a5d-6e93e3196628",
                            "type": "OS::Cinder::Volume"
                        },
                        {
                            "id": "62e51e85-4f31-441f-9a5d-6e93e3196628",
                            "type": "OS::Cinder::Volume"
                        }
                    ],
                }
            }
        ]
        return return_stub
开发者ID:Bloomie,项目名称:smaug,代码行数:32,代码来源:manager.py

示例7: list_protectable_instances

    def list_protectable_instances(self, context,
                                   protectable_type=None,
                                   marker=None,
                                   limit=None,
                                   sort_keys=None,
                                   sort_dirs=None,
                                   filters=None):

        LOG.info(_LI("Start to list protectable instances of type: %s"),
                 protectable_type)

        try:
            resource_instances = self.protectable_registry.list_resources(
                context, protectable_type)
        except exception.ListProtectableResourceFailed as err:
            LOG.error(_LE("List resources of type %(type)s failed: %(err)s"),
                      {'type': protectable_type,
                       'err': six.text_type(err)})
            raise

        result = []
        for resource in resource_instances:
            result.append(dict(id=resource.id, name=resource.name))

        return result
开发者ID:TommyLike,项目名称:smaug,代码行数:25,代码来源:manager.py

示例8: restore

    def restore(self, context, restore=None):
        LOG.info(_LI("Starting restore service:restore action"))
        LOG.debug('restore :%s tpye:%s', restore,
                  type(restore))

        # TODO(wangliuan)
        return True
开发者ID:Bloomie,项目名称:smaug,代码行数:7,代码来源:manager.py

示例9: delete

    def delete(self, context, provider_id, checkpoint_id):
        # TODO(wangliuan)
        LOG.info(_LI("Starting protection service:delete action"))
        LOG.debug('provider_id :%s checkpoint_id:%s', provider_id,
                  checkpoint_id)

        return True
开发者ID:Bloomie,项目名称:smaug,代码行数:7,代码来源:manager.py

示例10: create

def create(context, conf, **kwargs):
    auth_url = kwargs["auth_url"]
    username = kwargs["username"]
    password = kwargs["password"]
    tenant_name = context.project_name
    LOG.info(_LI('Creating heat client with url %s.'), auth_url)
    try:
        keystone = kc.Client(version=KEYSTONECLIENT_VERSION,
                             username=username,
                             tenant_name=tenant_name,
                             password=password,
                             auth_url=auth_url)

        auth_token = keystone.auth_ref['token']['id']
        heat_endpoint = ''
        services = keystone.auth_ref['serviceCatalog']
        for service in services:
            if service['name'] == 'heat':
                heat_endpoint = service['endpoints'][0]['publicURL']
        heat = hc.Client(HEATCLIENT_VERSION, endpoint=heat_endpoint,
                         token=auth_token)
        return heat
    except Exception:
        LOG.error(_LE('Creating heat client with url %s.'), auth_url)
        raise
开发者ID:TommyLike,项目名称:smaug,代码行数:25,代码来源:heat.py

示例11: _get_all

    def _get_all(self, context):
        check_policy(context, 'get_all')

        protectable_types = self.protection_api.list_protectable_types(context)

        LOG.info(_LI("Get all protectable types completed successfully."))
        return protectable_types
开发者ID:Bloomie,项目名称:smaug,代码行数:7,代码来源:protectables.py

示例12: instances_show

    def instances_show(self, req, protectable_type, protectable_id):
        """Return a instance about the given protectable_type and id."""

        context = req.environ['smaug.context']
        LOG.info(_LI("Show the instance of a given protectable"
                     " type: %s"), protectable_type)

        protectable_types = self._get_all(context)

        if protectable_type not in protectable_types:
            msg = _("Invalid protectable type provided.")
            raise exception.InvalidInput(reason=msg)

        instance = self.protection_api.\
            show_protectable_instance(context, protectable_type,
                                      protectable_id)
        if instance is None:
            raise exception.InvalidProtectableInstance(
                protectable_id=instance.get('id'))

        dependents = self.protection_api.\
            list_protectable_dependents(context, protectable_id,
                                        protectable_type)
        instance["dependent_resources"] = dependents

        retval_instance = self._view_builder.detail(req, instance)
        return retval_instance
开发者ID:Bloomie,项目名称:smaug,代码行数:27,代码来源:protectables.py

示例13: _checkpoints_get_all

    def _checkpoints_get_all(self, context, provider_id, marker=None,
                             limit=None, sort_keys=None, sort_dirs=None,
                             filters=None, offset=None):
        check_policy(context, 'checkpoint_get_all')

        if filters is None:
            filters = {}

        try:
            if limit is not None:
                limit = int(limit)
                if limit <= 0:
                    msg = _('limit param must be positive')
                    raise exception.InvalidInput(reason=msg)
        except ValueError:
            msg = _('limit param must be an integer')
            raise exception.InvalidInput(reason=msg)

        if filters:
            LOG.debug("Searching by: %s.", six.text_type(filters))

        checkpoints = self.protection_api.list_checkpoints(
            context, provider_id, marker, limit,
            sort_keys=sort_keys,
            sort_dirs=sort_dirs,
            filters=filters,
            offset=offset)

        LOG.info(_LI("Get all checkpoints completed successfully."))
        return checkpoints
开发者ID:WeAreFormalGroup,项目名称:smaug,代码行数:30,代码来源:providers.py

示例14: index

    def index(self, req):
        """Returns a list of protectable_types,

        transformed through view builder.
        """
        context = req.environ['smaug.context']
        LOG.info(_LI("Show protectable type list"), context=context)

        protectable_types = self._get_all(context)
        retval_protectable_types = {
            "protectable_type": protectable_types
        }

        LOG.info(_LI("Show protectable type list request issued"
                     " successfully."))
        return retval_protectable_types
开发者ID:Bloomie,项目名称:smaug,代码行数:16,代码来源:protectables.py

示例15: create

def create(context, conf):
    register_opts(conf)

    if hasattr(conf.swift_client, 'swift_auth_url') and \
            conf.swift_client.swift_auth_url:
        connection = swift.Connection(
            authurl=conf.swift_client.swift_auth_url,
            auth_version=conf.swift_client.swift_auth_version,
            tenant_name=conf.swift_client.swift_tenant_name,
            user=conf.swift_client.swift_user,
            key=conf.swift_client.swift_key,
            retries=conf.swift_client.swift_retry_attempts,
            starting_backoff=conf.swift_client.swift_retry_backoff,
            insecure=conf.swift_client.swift_auth_insecure,
            cacert=conf.swift_client.swift_ca_cert_file)
    else:
        try:
            url = utils.get_url(SERVICE, context, conf,
                                append_project_fmt='%(url)s/AUTH_%(project)s')
        except Exception:
            LOG.error(_LE("Get swift service endpoint url failed"))
            raise
        LOG.info(_LI("Creating swift client with url %s."), url)
        connection = swift.Connection(
            preauthurl=url,
            preauthtoken=context.auth_token,
            retries=conf.swift_client.swift_retry_attempts,
            starting_backoff=conf.swift_client.swift_retry_backoff,
            insecure=conf.swift_client.swift_auth_insecure,
            cacert=conf.swift_client.swift_ca_cert_file)
    return connection
开发者ID:TommyLike,项目名称:smaug,代码行数:31,代码来源:swift.py


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