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

Bug 1722933

Summary: ovirt-iso-uploader not parsing ssh login credentials correctly.
Product: Red Hat Enterprise Virtualization Manager Reporter: Bimal Chollera <bcholler>
Component: ovirt-iso-uploaderAssignee: Asaf Rachmani <arachman>
Status: CLOSED ERRATA QA Contact: Petr Kubica <pkubica>
Severity: medium Docs Contact:
Priority: high    
Version: 4.3.4CC: gzaidman, jzmeskal, lleistne, mtessun, sgoodman
Target Milestone: ovirt-4.3.5Keywords: Patch, Regression, ZStream
Target Release: 4.3.5Flags: jzmeskal: testing_plan_complete+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovirt-iso-uploader-4.3.2-1.el7ev Doc Type: Bug Fix
Doc Text:
Previously, the ovirt-iso-uploader tool did not parse ssh login credentials correctly, and consequently, you could not use it to upload ISO images. This bug has been fixed, so that now you can upload ISO images.
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-08-12 11:55:03 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Integration RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1723737    

Description Bimal Chollera 2019-06-21 18:14:15 UTC
Description of problem:

ovirt-iso-uploader not parsing ssh login credentials correctly.

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

~~~
ovirt-engine-4.3.3.7-0.1.el7.noarch
ovirt-iso-uploader-4.3.1-1.el7ev.noarch
~~~

How reproducible:
100%


Steps to Reproduce:
1. ovirt-iso-uploader to upload iso to a iso domain.
2.
3.

Actual results:

~~~
# engine-iso-uploader -v --ssh-user=root --key-file=/etc/pki/ovirt-engine/keys/engine_id_rsa -i iso upload test.iso
Please provide the REST API password for the admin@internal oVirt Engine user (CTRL+D to abort): 
DEBUG: API Vendor(None)	API Version(4.3.0)
DEBUG: id=220ac4f8-0df6-49ae-bb52-78d122aef4f2 address=XX.XX.XXX.XXX path=/home/test
Uploading, please wait...
INFO: Start uploading test.iso 
DEBUG: file (test.iso)
DEBUG: /usr/bin/ssh-p22-i /etc/pki/ovirt-engine/keys/engine_id_rsa  root.XXX.XXX "/usr/bin/test -e /home/test/220ac4f8-0df6-49ae-bb52-78d122aef4f2/images/11111111-1111-1111-1111-111111111111/test.iso"
DEBUG: /usr/bin/ssh-p22-i /etc/pki/ovirt-engine/keys/engine_id_rsa  root.XXX.XXX "/usr/bin/test -e /home/test/220ac4f8-0df6-49ae-bb52-78d122aef4f2/images/11111111-1111-1111-1111-111111111111/test.iso"
DEBUG: _cmds(['/usr/bin/ssh-p22-i', '/etc/pki/ovirt-engine/keys/engine_id_rsa', 'root.XXX.XXX', '/usr/bin/test -e /home/test/220ac4f8-0df6-49ae-bb52-78d122aef4f2/images/11111111-1111-1111-1111-111111111111/test.iso'])
DEBUG: exists returning false
DEBUG: Mount point size test command is /usr/bin/ssh-p22-i /etc/pki/ovirt-engine/keys/engine_id_rsa  {root@}{XX.XX.XXX.XXX} "{/usr/bin/python} -c 'import os;dir_stat = os.statvfs(\"{/home/test}\"); print (dir_stat.f_bavail * dir_stat.f_frsize)'" 
ERROR: Unable to copy test.iso to ISO storage domain on iso.
ERROR: Error message is "unable to test the available space on /home/test"
~~~

Notice the following lines from the above verbose output:

~~~
DEBUG: /usr/bin/ssh-p22-i /etc/pki/ovirt-engine/keys/engine_id_rsa  root.XXX.XXX "/usr/bin/test -e /home/test/220ac4f8-0df6-49ae-bb52-78d122aef4f2/images/11111111-1111-1111-1111-111111111111/test.iso"
DEBUG: /usr/bin/ssh-p22-i /etc/pki/ovirt-engine/keys/engine_id_rsa  root.XXX.XXX "/usr/bin/test -e /home/test/220ac4f8-0df6-49ae-bb52-78d122aef4f2/images/11111111-1111-1111-1111-111111111111/test.iso"
DEBUG: _cmds(['/usr/bin/ssh-p22-i', '/etc/pki/ovirt-engine/keys/engine_id_rsa', 'root.XXX.XXX', '/usr/bin/test -e /home/test/220ac4f8-0df6-49ae-bb52-78d122aef4f2/images/11111111-1111-1111-1111-111111111111/test.iso'])

The executed file is: /usr/bin/ssh-p22-i ...

The executed file should be: /usr/bin/ssh -p 22 -i ...
~~~

Also the following:

~~~
DEBUG: Mount point size test command is /usr/bin/ssh-p22-i /etc/pki/ovirt-engine/keys/engine_id_rsa  {root@}{XX.XX.XXX.XXX} "{/usr/bin/python} -c 'import os;dir_stat = os.statvfs(\"{/home/test}\"); print (dir_stat.f_bavail * dir_stat.f_frsize)'" 

You can also see that the ssh user and destination are: {root@}{XX.XX.XXX.XXX} 

They should be: root.XXX.XXX'
~~~


Expected results:

Should complete without errors.

Additional info:

Modified /usr/lib/python2.7/site-packages/ovirt_iso_uploader/__main.py
engine-iso-uploader uploads successfully.

~~~
diff /usr/lib/python2.7/site-packages/ovirt_iso_uploader/__main.py /usr/lib/python2.7/site-packages/ovirt_iso_uploader/__main.py-fixed

689c689
<         port_flag = "-p" if cmd.startswith(SSH) else "-P"
---
>         port_flag = " -p" if cmd.startswith(SSH) else " -P"
691c691
<             cmd += port_flag + "{0[ssh_port]}".format(self.configuration)
---
>             cmd += port_flag + " {0[ssh_port]}".format(self.configuration)
693c693
<             cmd += "-i {0[key_file]} ".format(self.configuration)
---
>             cmd += " -i {0[key_file]} ".format(self.configuration)
763,764c763,764
<             """ {{{user}}}{{{address}}} "{{{python}}} -c 'import os;"""
<             """dir_stat = os.statvfs(\\"{{{dir}}}\\"); """
---
>             """ {user}{address} "{python} -c 'import os;"""
>             """dir_stat = os.statvfs(\\"{dir}\\"); """
1187c1187
<                                 ' {user}{address} "{chmod}'
---
>                                 ' {user}{address} "{chmod} '
~~~

~~~
...
DEBUG: _cmds(['/usr/bin/ssh', '-p', '22', '-i', '/etc/pki/ovirt-engine/keys/engine_id_rsa', 'root.XXX.XXX', '/bin/mv -fv /home/test/220ac4f8-0df6-49ae-bb52-78d122aef4f2/images/11111111-1111-1111-1111-111111111111/.test.iso /home/test/220ac4f8-0df6-49ae-bb52-78d122aef4f2/images/11111111-1111-1111-1111-111111111111/test.iso'])
root.XXX.XXX's password: 
DEBUG: returncode(0)
DEBUG: STDOUT(‘/home/test/220ac4f8-0df6-49ae-bb52-78d122aef4f2/images/11111111-1111-1111-1111-111111111111/.test.iso’ -> ‘/home/test/220ac4f8-0df6-49ae-bb52-78d122aef4f2/images/11111111-1111-1111-1111-111111111111/test.iso’
)
DEBUG: STDERR()
INFO: test.iso uploaded successfully
~~~

Comment 1 Sandro Bonazzola 2019-06-24 07:41:17 UTC
Thanks for the report and for the suggested patch!

Comment 3 Gal Zaidman 2019-06-24 11:14:24 UTC
*** Bug 1723299 has been marked as a duplicate of this bug. ***

Comment 5 Petr Kubica 2019-07-16 14:29:55 UTC
Verified in
ovirt-iso-uploader-4.3.2-1.el7ev.noarch

Comment 7 errata-xmlrpc 2019-08-12 11:55:03 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:2441

Comment 8 Daniel Gur 2019-08-28 13:13:35 UTC
sync2jira

Comment 9 Daniel Gur 2019-08-28 13:17:48 UTC
sync2jira