Bug 1303715 - [ovirt-shell] download_ca_certificate() should handle url without /ovirt-engine/api
[ovirt-shell] download_ca_certificate() should handle url without /ovirt-engi...
Product: ovirt-engine-cli
Classification: oVirt
Component: Core (Show other bugs)
Unspecified Unspecified
unspecified Severity low (vote)
: ovirt-4.1.0-alpha
: ---
Assigned To: Juan Hernández
Pavel Stehlik
Depends On:
  Show dependency treegraph
Reported: 2016-02-01 13:00 EST by Jiri Belka
Modified: 2016-05-10 06:30 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2016-05-10 06:30:06 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: Infra
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
oourfali: ovirt‑4.1?
rule-engine: planning_ack?
rule-engine: devel_ack?
rule-engine: testing_ack?

Attachments (Terms of Use)

  None (edit)
Description Jiri Belka 2016-02-01 13:00:15 EST
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
         ca_fd, ca_file = tempfile.mkstemp()

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

How reproducible:

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

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 12:00:21 EDT
Sounds more like a RFE to me than a bug, no?
Comment 2 Juan Hernández 2016-05-10 06:30:06 EDT
There are no plans to update the CLI, so this won't be fixed.

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