Bug 1193238

Summary: Specifying a --source option doesn't overwrite the built-in templates
Product: [Community] Virtualization Tools Reporter: James (purpleidea) <jshubin>
Component: libguestfsAssignee: Pino Toscano <ptoscano>
Status: CLOSED UPSTREAM QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: jshubin, ptoscano, rbalakri
Target Milestone: ---   
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-05 16:36:27 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:

Description James (purpleidea) 2015-02-16 23:16:38 UTC
Description of problem:

I built a custom index. I point to it with --source
Unfortunately, because there is already a machine with the same name in the public index, that machine is seen, and mine is not.

I would expect:
1) That anything specified with --source take precedence *over* any built-ins.
2) There be an option to only show images from --source when desired. eg: --only-include-manual-sources (or something with a better name)

Version-Release number of selected component (if applicable):
$ virt-builder --version
virt-builder 1.28.6


How reproducible:
100%


Additional info:

This feature is pretty important for anyone trying to have a custom index to build an image variant for something that already exists in stock repos.

Comment 1 Pino Toscano 2015-02-17 15:08:30 UTC
(In reply to James (purpleidea) from comment #0)
> 1) That anything specified with --source take precedence *over* any
> built-ins.

--source just adds new sources to the existing sources, with no special treatment.  This means they are merged together the processed repositories, so any of the templates in the specified --source is used only whether (a) doesn't exist already (b) exist but its architecture does not exist (c) exist already also for its architecture, but its revision= is greater.

The change to process --source options ahead of repositories is easy to do, although it won't change the result in case the template you are "overriding" get a revision bump; sent for review:
  https://www.redhat.com/archives/libguestfs/2015-February/msg00160.html

Comment 2 James (purpleidea) 2015-02-17 15:27:42 UTC
(In reply to Pino Toscano from comment #1)
> (In reply to James (purpleidea) from comment #0)
> > 1) That anything specified with --source take precedence *over* any
> > built-ins.
> 
> --source just adds new sources to the existing sources, with no special
> treatment.  This means they are merged together the processed repositories,
> so any of the templates in the specified --source is used only whether (a)
> doesn't exist already (b) exist but its architecture does not exist (c)
> exist already also for its architecture, but its revision= is greater.
> 
> The change to process --source options ahead of repositories is easy to do,
> although it won't change the result in case the template you are
> "overriding" get a revision bump; sent for review:
>   https://www.redhat.com/archives/libguestfs/2015-February/msg00160.html

Cool... Would having an --only-source type option make sense or be useful to anyone besides me?

Comment 3 Pino Toscano 2015-02-17 15:39:03 UTC
(In reply to James (purpleidea) from comment #0)
> 2) There be an option to only show images from --source when desired. eg:
> --only-include-manual-sources (or something with a better name)

virt-builder uses XDG paths (the $XDG_CONFIG_DIRS envvar for system paths, and $XDG_CONFIG_HOME for user's one) as base for the repositories; if you don't want to use them, it should be enough to set them empty:
  env XDG_CONFIG_DIRS="" virt-builder ...

Comment 4 Pino Toscano 2015-02-18 14:29:24 UTC
(In reply to Pino Toscano from comment #1)
> (In reply to James (purpleidea) from comment #0)
> > 1) That anything specified with --source take precedence *over* any
> > built-ins.
> 
> --source just adds new sources to the existing sources, with no special
> treatment.  This means they are merged together the processed repositories,
> so any of the templates in the specified --source is used only whether (a)
> doesn't exist already (b) exist but its architecture does not exist (c)
> exist already also for its architecture, but its revision= is greater.
> 
> The change to process --source options ahead of repositories is easy to do,
> although it won't change the result in case the template you are
> "overriding" get a revision bump; sent for review:
>   https://www.redhat.com/archives/libguestfs/2015-February/msg00160.html

This is fixed with
https://github.com/libguestfs/libguestfs/commit/17dabd57c78c021f17169fe69643a35c6c3b7ef9
which is in libguestfs >= 1.29.27.

Comment 5 Pino Toscano 2016-05-05 16:36:27 UTC
Reading again the original bug report:
(1) has been fixed one year ago (see comment #4)
(2) is possible by setting the XDG_CONFIG_DIRS and XDG_CONFIG_HOME envvars (see comment #3, and the virt-builder man page)

Hence, this bug report can be closed now -- feel free to reopen in case you think something has not been fixed yet.