Bug 986491 - Support https:// URL for Yum repo (RepoProvider.java)
Support https:// URL for Yum repo (RepoProvider.java)
Status: CLOSED CURRENTRELEASE
Product: RHQ Project
Classification: Other
Component: Content (Show other bugs)
4.5
Unspecified Unspecified
unspecified Severity unspecified (vote)
: ---
: RHQ 4.9
Assigned To: Lukas Krejci
Mike Foley
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-19 18:59 EDT by Elias Ross
Modified: 2014-03-26 04:31 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-03-26 04:31:43 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Simple patch; seems to work for https: and auth'd URLs (6.10 KB, patch)
2013-07-19 19:47 EDT, Elias Ross
no flags Details | Diff

  None (edit)
Description Elias Ross 2013-07-19 18:59:54 EDT
modules/enterprise/server/plugins/yum/src/main/java/org/rhq/enterprise/server/plugins/yum/RepoProvider.java

The code does not support HTTPS, nor does it support arbitrary URLs:

        log.info("Initialized with location: " + location);
        if (location.startsWith("http://")) {
            reader = new HttpReader(location);
            return;
        }

        if (location.startsWith("file://")) { /// also why not 'file:/a/b/c ?
            location = location.substring(7);
            reader = new DiskReader(location);
            return;
        }

I'm guessing merging Disk/Http into one would make sense. Basically you can do:

try {
   reader = new HttpReader( new URL(location) );
} catch (MalformedURLException) {
   reader = new HttpReader( new File(location).toURL());
}

Disk/HttpReader are basically the same as well...
Comment 1 Elias Ross 2013-07-19 19:47:45 EDT
Created attachment 776029 [details]
Simple patch; seems to work for https: and auth'd URLs
Comment 2 Lukas Krejci 2013-08-19 12:24:15 EDT
Thanks for the patch, Elias, but in the end I decided to mostly not use it.

Your patch required the user info to be part of the URL and thus available in clear text to anyone "seeing" the configuration of the content source.

I dropped that requirement and introduced 2 new config properties - username and password that will be used in the same way as the userInfo part of the URL in your patch.

I also took the opportunity and refactored the code a bit along the lines you outlined - the code should now support at least file, http, https + any other scheme supported in by custom URL handlers available in the RHQ server's JVM.

If you find anything wrong with my fix, please shout and we'll hash it out...

commit 39b3cc10edb3c228a26c0d110a6873eddd5a39b0
Author: Lukas Krejci <lkrejci@redhat.com>
Date:   Mon Aug 19 17:52:53 2013 +0200

    [BZ 986491] - Yum content source plugin now handles HTTP basic auth
    
    It also should be able to handle HTTPS and other URL schemes if support for
    them is available in the RHQ server's JVM.
Comment 3 Elias Ross 2013-08-19 15:31:21 EDT
Thanks. I realize my patch wasn't perfect, however I was mainly just interested to fulfill the requirements of my use case, which is just testing to see how well remote package deployment performed. I may not get to test this until after RHQ 4.9 is released.
Comment 4 Heiko W. Rupp 2014-03-26 04:31:43 EDT
Bulk closing now that 4.10 is out.

If you think an issue is not resolved, please open a new BZ and link to the existing one.

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