Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1373431

Summary: Reading empty list of elements doesn't work correctly
Product: [oVirt] ovirt-engine-sdk-python Reporter: Juan Hernández <juan.hernandez>
Component: CoreAssignee: Juan Hernández <juan.hernandez>
Status: CLOSED CURRENTRELEASE QA Contact: Petr Matyáš <pmatyas>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 4.1.0aCC: bugs, juan.hernandez, lsvaty, omachace, pmatyas, rmartins
Target Milestone: ovirt-4.0.4Keywords: Regression
Target Release: 4.0.1Flags: juan.hernandez: ovirt-4.0.z?
rule-engine: blocker?
juan.hernandez: planning_ack?
juan.hernandez: devel_ack+
rule-engine: testing_ack+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovirt-engine-sdk-4.0.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-09-26 12:32:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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