Project

Profile

Help

Issue #4509

API docs returning different values

Added by kersom 7 months ago. Updated 6 months ago.

Status:
CLOSED - NOTABUG
Priority:
Normal
Category:
-
Sprint/Milestone:
Start date:
Due date:
Severity:
2. Medium
Version:
Platform Release:
Blocks Release:
OS:
Backwards Incompatible:
No
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
API Bindings
QA Contact:
Complexity:
Smash Test:
Verified:
No
Verification Required:
No
Sprint:
Sprint 51

Description

When accessing the auto-generated docs endpoint, /pulp/api/v3/docs/.json?format=openapi via browser the values below are returned.

  "Upload": {
      "type": "object",
      "properties": {
        "_href": {
          "title": " href",
          "type": "string",
          "format": "uri",
          "readOnly": true
        },
        "file": {
          "title": "File",
          "type": "string",
          "readOnly": true
        },
        "offset": {
          "title": "Offset",
          "type": "integer",
          "maximum": 9223372036854776000,
          "minimum": -9223372036854776000
        },
        "expires_at": {
          "title": "Expires at",
          "type": "string",
          "readOnly": true
        }
      }
    },

When using the smash API client to access the same endpoint, different values are returned.

  "Upload": {
      "type": "object",
      "properties": {
        "_href": {
          "title": " href",
          "type": "string",
          "format": "uri",
          "readOnly": true
        },
        "file": {
          "title": "File",
          "type": "string",
          "readOnly": true
        },
        "offset": {
          "title": "Offset",
          "type": "integer",
          "maximum": 9223372036854775807,
          "minimum": -9223372036854775808
        },
        "expires_at": {
          "title": "Expires at",
          "type": "string",
          "readOnly": true
        }
      }
    },

Sample script to fetch previous values.

        from urllib.parse import urljoin
        from pulp_smash import api, config
        from pulp_smash.pulp3.constants import API_DOCS_PATH
        API_SCHEMA_PATH = urljoin(API_DOCS_PATH, '.json?format=openapi')
        cfg = config.get_config()
        client = api.Client(cfg, api.json_handler)
        generated_open_api = client.get(API_SCHEMA_PATH)

journalctl -f

Mar 06 15:04:36 p3.pulp.vm audit[749]: AVC avc:  denied  { name_connect } for  pid=749 comm="nginx" dest=8000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:soundd_port_t:s0 tclass=tcp_socket permissive=1
Mar 06 15:04:36 p3.pulp.vm gunicorn[806]: /usr/local/lib/pulp/lib64/python3.7/site-packages/whitenoise/base.py:104: UserWarning: No directory at: /var/lib/pulp/static/
Mar 06 15:04:36 p3.pulp.vm gunicorn[806]:   warnings.warn(u'No directory at: {}'.format(root))
Mar 06 15:04:36 p3.pulp.vm gunicorn[806]: pulp: drf_yasg.generators:WARNING: url pattern does not end in $ ('^pulp/api/v3/docs/api(?P<format>\.json|\.yaml)') - unexpected things might happen
Mar 06 15:05:36 p3.pulp.vm chronyd[707]: Selected source 107.155.79.108
Mar 06 15:06:08 p3.pulp.vm gunicorn[806]: /usr/local/lib/pulp/lib64/python3.7/site-packages/django_filters/rest_framework/backends.py:128: UserWarning: <class 'pulpcore.app.viewsets.repository.RepositoryVersionViewSet'> is not compatible with schema generation
Mar 06 15:06:08 p3.pulp.vm gunicorn[806]:   "{} is not compatible with schema generation".format(view.__class__)
Mar 06 15:06:08 p3.pulp.vm gunicorn[806]: pulp: drf_yasg.generators:WARNING: url pattern does not end in $ ('^pulp/api/v3/docs/api(?P<format>\.json|\.yaml)') - unexpected things might happen
Mar 06 15:12:42 p3.pulp.vm systemd[1]: Starting dnf makecache...
Mar 06 15:12:44 p3.pulp.vm dnf[915]: Fedora Modular 29 - x86_64                       12 kB/s |  19 kB     00:01
Mar 06 15:12:44 p3.pulp.vm dnf[915]: Fedora Modular 29 - x86_64 - Updates             54 kB/s |  17 kB     00:00
Mar 06 15:12:49 p3.pulp.vm dnf[915]: Fedora Modular 29 - x86_64 - Updates            444 kB/s | 2.0 MB     00:04
Mar 06 15:12:49 p3.pulp.vm dnf[915]: Fedora 29 - x86_64 - Updates                    202 kB/s |  16 kB     00:00
Mar 06 15:13:45 p3.pulp.vm dnf[915]: Fedora 29 - x86_64 - Updates                    435 kB/s |  24 MB     00:55
Mar 06 15:13:52 p3.pulp.vm dnf[915]: Fedora 29 - x86_64                               14 kB/s |  19 kB     00:01
Mar 06 15:13:55 p3.pulp.vm dnf[915]: Metadata cache created.
Mar 06 15:13:55 p3.pulp.vm systemd[1]: Started dnf makecache.
Mar 06 15:13:55 p3.pulp.vm audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=dnf-makecache comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Mar 06 15:13:55 p3.pulp.vm audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=dnf-makecache comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Mar 06 15:17:42 p3.pulp.vm systemd[1]: Starting Cleanup of Temporary Directories...
Mar 06 15:17:42 p3.pulp.vm systemd-tmpfiles[944]: [/usr/lib/tmpfiles.d/mdadm.conf:1] Line references path below legacy directory /var/run/, updating /var/run/mdadm → /run/mdadm; please update the tmpfiles.d/ drop-in file accordingly.
Mar 06 15:17:42 p3.pulp.vm systemd-tmpfiles[944]: [/usr/lib/tmpfiles.d/postgresql.conf:1] Line references path below legacy directory /var/run/, updating /var/run/postgresql → /run/postgresql; please update the tmpfiles.d/ drop-in file accordingly.
Mar 06 15:17:42 p3.pulp.vm systemd-tmpfiles[944]: [/usr/lib/tmpfiles.d/samba.conf:1] Line references path below legacy directory /var/run/, updating /var/run/samba → /run/samba; please update the tmpfiles.d/ drop-in file accordingly.
Mar 06 15:17:42 p3.pulp.vm systemd[1]: Started Cleanup of Temporary Directories.
Mar 06 15:17:42 p3.pulp.vm audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-tmpfiles-clean comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Mar 06 15:17:42 p3.pulp.vm audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-tmpfiles-clean comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Mar 06 15:22:32 p3.pulp.vm gunicorn[806]: pulp: drf_yasg.generators:WARNING: url pattern does not end in $ ('^pulp/api/v3/docs/api(?P<format>\.json|\.yaml)') - unexpected things might happen
Mar 06 15:26:18 p3.pulp.vm gunicorn[806]: pulp: django.request:WARNING: Not Found: /pulp/api/v3/docs/.json
Mar 06 15:27:15 p3.pulp.vm dhclient[770]: DHCPREQUEST on ens3 to 192.168.122.1 port 67 (xid=0xaad9f959)
Mar 06 15:27:15 p3.pulp.vm dhclient[770]: DHCPACK from 192.168.122.1 (xid=0xaad9f959)
Mar 06 15:27:15 p3.pulp.vm NetworkManager[703]: <info>  [1551904035.3230] dhcp4 (ens3):   address 192.168.122.138
Mar 06 15:27:15 p3.pulp.vm NetworkManager[703]: <info>  [1551904035.3232] dhcp4 (ens3):   plen 24 (255.255.255.0)
Mar 06 15:27:15 p3.pulp.vm NetworkManager[703]: <info>  [1551904035.3232] dhcp4 (ens3):   gateway 192.168.122.1
Mar 06 15:27:15 p3.pulp.vm NetworkManager[703]: <info>  [1551904035.3233] dhcp4 (ens3):   lease time 3600
Mar 06 15:27:15 p3.pulp.vm NetworkManager[703]: <info>  [1551904035.3233] dhcp4 (ens3):   hostname 'p3'
Mar 06 15:27:15 p3.pulp.vm NetworkManager[703]: <info>  [1551904035.3233] dhcp4 (ens3):   nameserver '192.168.122.1'
Mar 06 15:27:15 p3.pulp.vm NetworkManager[703]: <info>  [1551904035.3233] dhcp4 (ens3): state changed bound -> bound
Mar 06 15:27:15 p3.pulp.vm dbus-daemon[687]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service' requested by ':1.2' (uid=0 pid=703 comm="/usr/sbin/NetworkManager --no-daemon " label="system_u:system_r:NetworkManager_t:s0")
Mar 06 15:27:15 p3.pulp.vm systemd[1]: Starting Network Manager Script Dispatcher Service...
Mar 06 15:27:15 p3.pulp.vm dbus-daemon[687]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Mar 06 15:27:15 p3.pulp.vm audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=NetworkManager-dispatcher comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Mar 06 15:27:15 p3.pulp.vm systemd[1]: Started Network Manager Script Dispatcher Service.
Mar 06 15:27:15 p3.pulp.vm nm-dispatcher[980]: req:1 'dhcp4-change' [ens3]: new request (3 scripts)
Mar 06 15:27:15 p3.pulp.vm nm-dispatcher[980]: req:1 'dhcp4-change' [ens3]: start running ordered scripts...
Mar 06 15:27:15 p3.pulp.vm dhclient[770]: bound to 192.168.122.138 -- renewal in 1326 seconds.
Mar 06 15:27:25 p3.pulp.vm audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=NetworkManager-dispatcher comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Mar 06 15:29:39 p3.pulp.vm audit[749]: AVC avc:  denied  { name_connect } for  pid=749 comm="nginx" dest=8000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:soundd_port_t:s0 tclass=tcp_socket permissive=1
Mar 06 15:33:13 p3.pulp.vm gunicorn[806]: pulp: drf_yasg.generators:WARNING: url pattern does not end in $ ('^pulp/api/v3/docs/api(?P<format>\.json|\.yaml)') - unexpected things might happen
Mar 06 15:33:39 p3.pulp.vm chronyd[707]: Source 2600:3c02::13:5230 replaced with 23.239.24.67

Pulpcore and Pulp-File installation from source. MAR/05/2019.

pulp_api_json.png (17.6 KB) kersom, 03/06/2019 09:57 PM pulp_api_json.png
250

Related issues

Related to Pulp - Test #4123: Test the generated API binds MODIFIED Actions

History

#1 Updated by kersom 7 months ago

  • Related to Test #4123: Test the generated API binds added

#3 Updated by CodeHeeler 7 months ago

  • Triaged changed from No to Yes
  • Sprint set to Sprint 50

#4 Updated by dkliban@redhat.com 7 months ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to dkliban@redhat.com

#5 Updated by dkliban@redhat.com 7 months ago

It looks like the browser rounds the number, but Python does not round the number.

9223372036854776000 in the browser
9223372036854775807 in the python output.

#6 Updated by rochacbruno 7 months ago

It is not the browser, but the response-handler.

pulp-smash uses `json_handler` the python JSON module loses numeric information.

To keep numeric precision we need to use https://github.com/josdejong/lossless-json

Other possibility is that this number is overflowing JS capacity https://www.exploringbinary.com/print-precision-of-floating-point-integers-varies-too/

#8 Updated by rchan 7 months ago

  • Sprint changed from Sprint 50 to Sprint 51

#9 Updated by dkliban@redhat.com 7 months ago

  • Status changed from ASSIGNED to CLOSED - NOTABUG

I am closing this because no changes are needed in pulp to resolve this issue.

#10 Updated by daviddavis 6 months ago

  • Sprint/Milestone set to 3.0

#11 Updated by bmbouter 6 months ago

  • Tags deleted (Pulp 3)

Please register to edit this issue

Also available in: Atom PDF