Bug 1854303 - [RFE] Please add Json stdout to example scripts
Summary: [RFE] Please add Json stdout to example scripts
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: ovirt-engine-sdk-python
Classification: oVirt
Component: RFEs
Version: 4.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Ori Liel
QA Contact: Avihai
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-07-07 07:05 UTC by Ilan Zuckerman
Modified: 2021-11-12 09:47 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-08-29 18:02:11 UTC
oVirt Team: Storage
Embargoed:


Attachments (Terms of Use)

Description Ilan Zuckerman 2020-07-07 07:05:40 UTC
Description of problem:

Currently, the example scripts found in   /usr/share/doc/python3-ovirt-engine-sdk4/   do not have an option of returning Json formatted std out.
They only return text stdout when they are done.
It would be very helpful, and relatively easy to add an option for returning Json type data as a result of script execution.
That way, it would be easier to parse the results.

The following scripts are in particular interest for me:
backup_vm.py
upload_disk.py 
download_disk.py


Version-Release number of selected component (if applicable):
python3-ovirt-engine-sdk4-4.4.4-1.el8ev.x86_64

Comment 1 Nir Soffer 2020-07-07 09:36:41 UTC
I think we can change the examples to use stderr for messages
instead of stdout, and add --json option to write json object
to stdout with the details of the operation.

For example for upload_disk.py we we an have:

{
    "storage-domain": "storage-name",
    "disk": "disk-id",
    "transfer": "transfer-id",
    "transfer-host": "host1",
    "image": "/path/to/file",
    "image-format": "qcow2",
    "disk-name": "file.raw",
    "disk-format": "raw",
    ...
}


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