Bug 1327607

Summary: [PY3] when sending builds TypeError: <map object at 0x7f5a54772898> is not JSON serializable
Product: [Fedora] Fedora Reporter: Igor Gnatenko <ignatenko>
Component: python-coprAssignee: Jakub Kadlčík <jkadlcik>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: imvalgo, jkadlcik, msuchy
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-copr-1.68-1.fc22 python-copr-1.68-1.fc23 python-copr-1.68-1.fc24 python-copr-1.68-1.el7 python-copr-1.68-1.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-16 22:24:59 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Igor Gnatenko 2016-04-15 13:15:41 UTC
Traceback (most recent call last):
  File "run.py", line 78, in <module>
    main()
  File "run.py", line 73, in main
    _build_in_copr(args.srpm, args.project_owner, args.project_name)
  File "run.py", line 22, in _build_in_copr
    build = project.create_build_from_file(srpm, enable_net=False)
  File "/usr/lib/python3.5/site-packages/copr/client_v2/resources.py", line 300, in create_build_from_file
    return builds.create_from_file(self.id, *args, **kwargs)
  File "/usr/lib/python3.5/site-packages/copr/client_v2/handlers.py", line 179, in create_from_file
    obj=json.dumps(content), content_type="application/json")
  File "/usr/lib64/python3.5/json/__init__.py", line 230, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib64/python3.5/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib64/python3.5/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib64/python3.5/json/encoder.py", line 180, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: <map object at 0x7f5a54772898> is not JSON serializable

Comment 1 Igor Gnatenko 2016-04-15 13:21:03 UTC
https://github.com/fedora-copr/copr/pull/4

Comment 2 Jakub Kadlčík 2016-04-18 14:38:52 UTC
Reproducer:

COPR_URL = "http://copr-fe-dev.cloud.fedoraproject.org/"
from copr import create_client2_from_params
cl = create_client2_from_params(root_url=COPR_URL)
cl.builds.create_from_url(project_id=123, srpm_url="https://foo.bar/baz.src.rpm")

Comment 3 Igor Gnatenko 2016-04-18 14:40:06 UTC
(In reply to Jakub Kadlčík from comment #2)
> Reproducer:
> 
> COPR_URL = "http://copr-fe-dev.cloud.fedoraproject.org/"
> from copr import create_client2_from_params
> cl = create_client2_from_params(root_url=COPR_URL)
> cl.builds.create_from_url(project_id=123,
> srpm_url="https://foo.bar/baz.src.rpm")

yup. it's easy bug and easy fix and patch already sent ;)

Comment 4 Jakub Kadlčík 2016-04-18 14:47:07 UTC
> and patch already sent ;)

I know, I just wanted to try it before merge, so I also posted the reproducer here. 

Thank you for the patch, Igor

Comment 5 Jakub Kadlčík 2016-04-18 14:57:49 UTC
Oops, I forgot:

Modified in: a778a99
Merge: 2f9313d

Comment 6 Fedora Update System 2016-05-05 07:01:06 UTC
python-copr-1.68-1.fc22 copr-cli-1.50-1.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2016-83199bf70e

Comment 7 Fedora Update System 2016-05-05 07:01:40 UTC
python-copr-1.68-1.el7 copr-cli-1.50-1.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-9a4d5dfb13

Comment 8 Fedora Update System 2016-05-05 07:01:57 UTC
python-copr-1.68-1.fc24 copr-cli-1.50-1.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-e2be6d1814

Comment 9 Fedora Update System 2016-05-05 07:02:13 UTC
python-copr-1.68-1.fc23 copr-cli-1.50-1.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2016-99f84a68dc

Comment 10 Fedora Update System 2016-05-05 07:02:29 UTC
python-copr-1.68-1.el6 copr-cli-1.50-1.el6 has been submitted as an update to Fedora EPEL 6. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-d7889ce228

Comment 11 Fedora Update System 2016-05-05 09:53:59 UTC
copr-cli-1.50-1.fc24, python-copr-1.68-1.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-e2be6d1814

Comment 12 Fedora Update System 2016-05-05 15:52:13 UTC
copr-cli-1.50-1.fc23, python-copr-1.68-1.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-99f84a68dc

Comment 13 Fedora Update System 2016-05-05 21:18:37 UTC
copr-cli-1.50-1.el6, python-copr-1.68-1.el6 has been pushed to the Fedora EPEL 6 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-d7889ce228

Comment 14 Fedora Update System 2016-05-05 21:24:05 UTC
copr-cli-1.50-1.el7, python-copr-1.68-1.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-9a4d5dfb13

Comment 15 Fedora Update System 2016-05-06 09:22:50 UTC
copr-cli-1.50-1.fc22, python-copr-1.68-1.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-83199bf70e

Comment 16 Fedora Update System 2016-05-16 22:24:37 UTC
copr-cli-1.50-1.fc22, python-copr-1.68-1.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.

Comment 17 Fedora Update System 2016-05-16 22:27:48 UTC
copr-cli-1.50-1.fc23, python-copr-1.68-1.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.

Comment 18 Fedora Update System 2016-05-20 17:42:01 UTC
copr-cli-1.50-1.fc24, python-copr-1.68-1.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.

Comment 19 Fedora Update System 2016-05-20 20:19:07 UTC
copr-cli-1.50-1.el7, python-copr-1.68-1.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report.

Comment 20 Fedora Update System 2016-05-21 05:18:50 UTC
copr-cli-1.50-1.el6, python-copr-1.68-1.el6 has been pushed to the Fedora EPEL 6 stable repository. If problems still persist, please make note of it in this bug report.