Bug 1303715

Summary: [ovirt-shell] download_ca_certificate() should handle url without /ovirt-engine/api
Product: [oVirt] ovirt-engine-cli Reporter: Jiri Belka <jbelka>
Component: CoreAssignee: Juan Hernández <juan.hernandez>
Status: CLOSED WONTFIX QA Contact: Pavel Stehlik <pstehlik>
Severity: low Docs Contact:
Priority: unspecified    
Version: 3.6.2.0CC: bugs, oourfali
Target Milestone: ---Flags: sbonazzo: ovirt-4.1-
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-10 10:30:06 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 Jiri Belka 2016-02-01 18:00:15 UTC
Description of problem:

if user has:

$ grep url .ovirtshellrc                                                                                                      
url = https://jb-rhevm36.rhev.lab.eng.brq.redhat.com

re.sub won't match. just a proposal, maybe urlparse is better.

--- /usr/local/lib/python2.7/site-packages/ovirtcli/platform/posix/spice.py.orig        Mon Feb  1 18:55:39 2016
+++ /usr/local/lib/python2.7/site-packages/ovirtcli/platform/posix/spice.py     Mon Feb  1 18:56:12 2016
@@ -156,7 +156,7 @@ def launch_remote_viewer(cmd, host, host_subject, port
 def download_ca_certificate(url):
     """Downloads the CA certificate from the engine."""
 
-    ca_url = re.sub("^https?://([^/]+)/.*", "http://\\1/ca.crt", url)
+    ca_url = re.sub("^https?://([^/]+)(/.*)?", "http://\\1/ca.crt", url)
     ca_file = None
     try:
         ca_fd, ca_file = tempfile.mkstemp()


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

How reproducible:
100%

Steps to Reproduce:
1. put url without /ovirt-engine/api
2. console $vm
3.

Actual results:
failure, ca_file would be html page of $url and not ca file

Expected results:
should work as we can't be sure user knows he should put /ovirt-engine/api

Additional info:

Comment 1 Yaniv Kaul 2016-03-13 16:00:21 UTC
Sounds more like a RFE to me than a bug, no?

Comment 2 Juan Hernández 2016-05-10 10:30:06 UTC
There are no plans to update the CLI, so this won't be fixed.