Skip to content
This repository was archived by the owner on Nov 13, 2023. It is now read-only.

Can't get result by page in sercuritygroups api #7

@niejn

Description

@niejn

def test_security_groups(os_conn):

query = {
"limit": 2
}
objs = os_conn.vpcv1.security_groups(**query)
objs = list(objs)
for obj in objs:
print(obj)

设置limit为2, 但是返回了所有的security groups, limit不起作用,
只有修改sdk中v1/_proxy.py 将self._list(_security_group.SecurityGroup, paginated=True,
**query)改为self._list(_security_group.SecurityGroup, paginated=False,
**query)
sdk 函数如下:
def security_groups(self, **query):
"""Return a generator of security groups

:param dict query: Optional query parameters to be sent to limit
the resources being returned. Valid parameters are:

  • limit: The number of records returned on each page.
  • marker: The resource ID of pagination query.
  • vpc_id: The ID of the VPC this security group is
    associated with.
  • enterprise_project_id: The ID of the enterprise project.

:returns: A generator of security group objects
:rtype: :class:~openstack.vpc.v1.security_group.SecurityGroup
"""
return self._list(_security_group.
sdk中是将 paginated=True, 但是效果并没有按照每次返回一个page,而是全部返回了,paginated=False, 反而能够按page返回

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions