Bug 1722933 - ovirt-iso-uploader not parsing ssh login credentials correctly.
Summary: ovirt-iso-uploader not parsing ssh login credentials correctly.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-iso-uploader
Version: 4.3.4
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: ovirt-4.3.5
: 4.3.5
Assignee: Asaf Rachmani
QA Contact: Petr Kubica
URL:
Whiteboard:
: 1723299 (view as bug list)
Depends On:
Blocks: 1723737
TreeView+ depends on / blocked
 
Reported: 2019-06-21 18:14 UTC by Bimal Chollera
Modified: 2019-10-15 08:44 UTC (History)
5 users (show)

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.
Clone Of:
Environment:
Last Closed: 2019-08-12 11:55:03 UTC
oVirt Team: Integration
Target Upstream Version:
Embargoed:
jzmeskal: testing_plan_complete+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 4321631 0 None None None 2019-08-03 00:17:19 UTC
Red Hat Product Errata RHBA-2019:2441 0 None None None 2019-08-12 11:55:06 UTC
oVirt gerrit 101092 0 master MERGED ovirt-iso-uploader: Fix broken upload using ssh 2020-03-20 00:25:44 UTC
oVirt gerrit 101135 0 ovirt-iso-uploader-4.3 MERGED ovirt-iso-uploader: Fix broken upload using ssh 2020-03-20 00:25:44 UTC

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


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