Bug 1373431 - Reading empty list of elements doesn't work correctly
Summary: Reading empty list of elements doesn't work correctly
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine-sdk-python
Classification: oVirt
Component: Core
Version: 4.1.0a
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ovirt-4.0.4
: 4.0.1
Assignee: Juan Hernández
QA Contact: Petr Matyáš
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-09-06 09:20 UTC by Juan Hernández
Modified: 2016-09-26 12:32 UTC (History)
6 users (show)

Fixed In Version: ovirt-engine-sdk-4.0.1
Clone Of:
Environment:
Last Closed: 2016-09-26 12:32:43 UTC
oVirt Team: Infra
Embargoed:
juan.hernandez: ovirt-4.0.z?
rule-engine: blocker?
juan.hernandez: planning_ack?
juan.hernandez: devel_ack+
rule-engine: testing_ack+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 63385 0 None MERGED Fix reading of lists of elements 2021-02-18 18:35:17 UTC
oVirt gerrit 63388 0 sdk_4.0 MERGED Fix reading of lists of elements 2021-02-18 18:35:16 UTC

Description Juan Hernández 2016-09-06 09:20:35 UTC
Description of problem:

Currently when the SDK tries to read an empty list of elements, without a close tag, it fails to detect the end of the list correctly, and it includes the in the list the next elements.

Version-Release number of selected component (if applicable):

4.1.0.a


How reproducible:

Always.


Steps to Reproduce:
1. Make sure that at least one cluster has an empty list of required RNG sources.
2. Use the SDK to list the cluster:

---8<---
import ovirtsdk4 as sdk
import ovirtsdk4.types as types

connection = sdk.Connection(
    url='https://engine41.example.com/ovirt-engine/api',
    username='admin@internal',
    password='...',
    ca_file='ca.pem',
)

clusters_service = connection.system_service().clusters_service()

clusters = clusters_service.list()

for cluster in clusters:
    print("%s: %s" % (cluster.name, cluster.id))

connection.close()
---8<---


Actual results:

Traceback (most recent call last):
  File "./list_clusters.py", line 43, in <module>
    clusters = clusters_service.list()
  File "/files/projects/ovirt-engine-sdk-python/repository/sdk/lib/ovirtsdk4/services.py", line 3028, in list
    return readers.ClusterReader.read_many(reader)
  File "/files/projects/ovirt-engine-sdk-python/repository/sdk/lib/ovirtsdk4/readers.py", line 1791, in read_many
    objs.append(ClusterReader.read_one(reader))
  File "/files/projects/ovirt-engine-sdk-python/repository/sdk/lib/ovirtsdk4/readers.py", line 1744, in read_one
    obj.required_rng_sources = [types.RngSource(s.lower()) for s in Reader.read_strings(reader)]
AttributeError: 'NoneType' object has no attribute 'lower'

(Note that the backtrace may be different, depending on the actual content of the retrived cluster).


Expected results:

This should print the list of cluster names and identifiers:

Default: 00000002-0002-0002-0002-00000000017a
mycluster: 72e982ce-e010-4736-b8ab-dd31a8949f19

Comment 1 Red Hat Bugzilla Rules Engine 2016-09-06 09:20:42 UTC
This bug report has Keywords: Regression or TestBlocker.
Since no regressions or test blockers are allowed between releases, it is also being identified as a blocker for this release. Please resolve ASAP.

Comment 2 Petr Matyáš 2016-09-13 08:43:43 UTC
Verified on 4.0.4-3


Note You need to log in before you can comment on or make changes to this bug.