示例#1
0
    def list(self, detailed=True, limit=None, marker=None):
        """
        DEPRECATED: Get a list of all images.

        :rtype: list of :class:`Image`
        :param limit: maximum number of images to return.
        :param marker: Begin returning images that appear later in the image
                       list than that represented by this image id (optional).
        """
        # FIXME(mriedem): Should use the api_versions.wraps decorator but that
        # breaks the ManagerWithFind.findall method which checks the argspec
        # on this function looking for the 'detailed' arg, and it's getting
        # tripped up if you use the wraps decorator. This is all deprecated for
        # removal anyway so we probably don't care too much about this.
        if self.api.api_version > api_versions.APIVersion('2.35'):
            raise exceptions.VersionNotFoundForAPIMethod(
                self.api.api_version, 'list')
        warnings.warn(
            'The novaclient.v2.images module is deprecated and will be '
            'removed after Nova 15.0.0 is released. Use python-glanceclient '
            'or python-openstacksdk instead.', DeprecationWarning)
        params = {}
        detail = ''
        if detailed:
            detail = '/detail'
        if limit:
            params['limit'] = int(limit)
        if marker:
            params['marker'] = str(marker)
        params = sorted(params.items(), key=lambda x: x[0])
        query = '?%s' % parse.urlencode(params) if params else ''
        return self._list('/images%s%s' % (detail, query), 'images')
示例#2
0
        def substitution(obj, *args, **kwargs):
            methods = get_substitutions(name, obj.api_version)

            if not methods:
                raise exceptions.VersionNotFoundForAPIMethod(
                    obj.api_version.get_string(), name)
            return methods[-1].func(obj, *args, **kwargs)
示例#3
0
        def substitution(obj, *args, **kwargs):
            methods = get_substitutions(name, obj.api_version)

            if not methods:
                raise exceptions.VersionNotFoundForAPIMethod(
                    obj.api_version.get_string(), name)
            else:
                return max(methods, key=lambda f: f.start_version).func(
                    obj, *args, **kwargs)