Bug 986491 - Support https:// URL for Yum repo (RepoProvider.java)
Summary: Support https:// URL for Yum repo (RepoProvider.java)
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: Content
Version: 4.5
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: RHQ 4.9
Assignee: Lukas Krejci
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-07-19 22:59 UTC by Elias Ross
Modified: 2014-03-26 08:31 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-03-26 08:31:43 UTC
Embargoed:


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

Description Elias Ross 2013-07-19 22:59:54 UTC
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 23:47:45 UTC
Created attachment 776029 [details]
Simple patch; seems to work for https: and auth'd URLs

Comment 2 Lukas Krejci 2013-08-19 16:24:15 UTC
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>
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 19:31:21 UTC
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 08:31:43 UTC
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.