Bug 1865830

Summary: download_disk_snapshots.py example script is broken
Product: [oVirt] ovirt-engine-sdk-python Reporter: Ilan Zuckerman <izuckerm>
Component: GeneralAssignee: Ori Liel <oliel>
Status: CLOSED DEFERRED QA Contact: Avihai <aefrat>
Severity: medium Docs Contact:
Priority: unspecified    
Version: ---CC: aefrat, bugs, juan.hernandez, michal.skrivanek, tnisan
Target Milestone: ---Keywords: ZStream
Target Release: ---Flags: sbonazzo: ovirt-4.5-
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-04-11 08:54:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Storage RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
logs none

Description Ilan Zuckerman 2020-08-04 09:57:56 UTC
Created attachment 1710300 [details]
logs

Description of problem:

Example script for downloading snapshot disk is broken:
/usr/share/doc/python3-ovirt-engine-sdk4/examples/download_disk_snapshots.py

102             transfer_headers = {
103                 'Authorization': transfer.signed_ticket,
104             }

Authorization header is unused since 4.2.0, and in 4.4 it is always None, which breaks
this code.

We have a bug for removing it completely here:
https://bugzilla.redhat.com/show_bug.cgi?id=1862722

Version-Release number of selected component (if applicable):
python3-ovirt-engine-sdk4-4.4.4-1.el8ev.x86_64
rhv-release-4.4.1-12-001.noarch

How reproducible:
100%

Steps to Reproduce:
1. Modify the script with correct values:
url='https://storage-xxx.redhat.com/ovirt-engine/api',
        username='xxx',
        password='xxx',
        ca_file='/root/ca.pem',

    disk_id = '985c5bbb-2732-4738-8cbe-a2557fe9edd4'
    sd_name = 'iscsi_0'


2. python3 /usr/share/doc/python3-ovirt-engine-sdk4/examples/download_disk_snapshots.py


Actual results:

Downloading disk snapshot 6beb8bd7-c554-4277-a6ad-ebaa87af4167
Traceback (most recent call last):
  File "/usr/share/doc/python3-ovirt-engine-sdk4/examples/download_disk_snapshots.py", line 189, in <module>
    download_disk_snapshot(disk_snapshot)
  File "/usr/share/doc/python3-ovirt-engine-sdk4/examples/download_disk_snapshots.py", line 110, in download_disk_snapshot
    headers=transfer_headers,
  File "/usr/lib64/python3.6/http/client.py", line 1254, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib64/python3.6/http/client.py", line 1295, in _send_request
    self.putheader(hdr, value)
  File "/usr/lib64/python3.6/http/client.py", line 1231, in putheader
    if _is_illegal_header_value(values[i]):
TypeError: expected string or bytes-like object


Expected results:
Download should work

Additional info:
Attaching daemon.log example.log (log of the example script)

Comment 4 Michal Skrivanek 2022-04-11 08:54:13 UTC
no update for a while, didn't make it into 4.5, closing