Bug 986491

Summary: Support https:// URL for Yum repo (RepoProvider.java)
Product: [Other] RHQ Project Reporter: Elias Ross <genman>
Component: ContentAssignee: Lukas Krejci <lkrejci>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 4.5CC: hrupp
Target Milestone: ---   
Target Release: RHQ 4.9   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-03-26 08:31:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Simple patch; seems to work for https: and auth'd URLs none

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.