#1432 regression: 'is_a_group_project': ['Unknown field.']
Closed: Fixed 3 years ago by praiskup. Opened 3 years ago by crobinso.

$ cat test.py
import copr
client = copr.ClientV2.create_from_file_config()
projects = client.projects.get_list(
        name="virt-preview", owner="@virtmaint-sig")

$ python3 test.py
Traceback (most recent call last):
  File "test.py", line 4, in <module>
    projects = client.projects.get_list(
  File "/usr/lib/python3.8/site-packages/copr/client_v2/handlers.py", line 298, in get_list
    return ProjectList.from_response(self, response, options)
  File "/usr/lib/python3.8/site-packages/copr/client_v2/resources.py", line 545, in from_response
    individuals = [
  File "/usr/lib/python3.8/site-packages/copr/client_v2/resources.py", line 546, in <listcomp>
    Project.from_response(
  File "/usr/lib/python3.8/site-packages/copr/client_v2/resources.py", line 326, in from_response
    entity = ProjectEntity.from_dict(data_dict["project"])
  File "/usr/lib/python3.8/site-packages/copr/client_v2/entities.py", line 50, in from_dict
    parsed = cls._schema.load(raw_dict)
  File "/usr/lib/python3.8/site-packages/marshmallow/schema.py", line 680, in load
    return self._do_load(
  File "/usr/lib/python3.8/site-packages/marshmallow/schema.py", line 840, in _do_load
    raise exc
marshmallow.exceptions.ValidationError: {'is_a_group_project': ['Unknown field.']}

$ rpm -q

This was not an error condition on f31 package versions at least. I can stop the the error by uncommenting the line here and my scripts work as expected afterwards: https://pagure.io/copr/copr/blob/master/f/python/copr/client_v2/schemas.py#_23


This deserves a bugfix, but of course you should move to v3 API:

from copr.v3 import Client
client = Client.create_from_config_file()
client.project_proxy.get(ownername="@virtmaint-sig", projectname="virt-preview")

WRT the fix, we should keep the attribute there to not break the API, but since it
is already broken ...

Thank you for the report!

Metadata Update from @praiskup:
- Issue tagged with: bug

3 years ago

Thanks. I fixed my code to use the v3 client API.

Is the 'fix' I posted all that it takes to solve this? If so I can submit a patch for that. If it's more involved than that I will leave it up to yall

I think (at this moment) we should keep that attribute in the model, and rather fix it.
But I haven't had a chance to check what would be a proper fix.

We'd use your patch if it eventually was the right fix. Thanks.

Ah, I thought you actually want to drop it from the model. So I think your
fix is correct, @crobinso are you interested in submitting PR for this?

Login to comment on this ticket.

Metadata
Related Pull Requests
  • #1455 Merged 3 years ago