Re: [PATCH 11/14] Store methodstr url of repo.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> diff --git a/yuminstall.py b/yuminstall.py
> index 13c56af..4fd4954 100644
> --- a/yuminstall.py
> +++ b/yuminstall.py
> @@ -243,6 +243,7 @@ class AnacondaYumRepo(YumRepository):
>      def __init__(self, *args, **kwargs):
>          YumRepository.__init__(self, *args, **kwargs)
>          self.enablegroups = True
> +        self._anacondabaseurls = []
>  
>      def needsNetwork(self):
>          def _isURL(s):
> @@ -267,6 +268,18 @@ class AnacondaYumRepo(YumRepository):
>                  if os.path.exists("%s/packages" % cachedir):
>                      shutil.rmtree("%s/packages" % cachedir)
>  
> +    # needed to store nfs: repo url that yum doesn't know
> +    @property
> +    def anacondabaseurls(self):
> +        return (self._anacondabaseurls or self.baseurl or
> +                (type(self.mirrorlist) is type([]) and self.mirrorlist) or
> +                [self.mirrorlist])
> +
> +
> +    @anacondabaseurls.setter
> +    def anacondabaseurls(self, value):
> +        self._anacondabaseurls = value
> +
>  class YumSorter(yum.YumBase):
>      def _transactionDataFactory(self):
>          return SplitMediaTransactionData()

I think adding the URL to the AnacondaRepo object is a good idea, but I
don't really like a couple things here.  First, we only used the
@whatever.setter syntax in one other place, and we got rid of it because
it was the only place we did that.  So you should probably use the other
property syntax here for consistency.

Second, the name should probably be something a little more readable -
anacondaBaseURL would be the obvious choice, but something shorter might
be nice too.

Third, the getter is a pretty gross conditional.  mirrorlist is never a
list - not in anaconda, and not in yum.  If it is ever a list, we're
going to hit tracebacks in a bunch of places.  So you can kill that part
of the test and instead make it something like:

   return self._anacondabaseurls or self.baseurl or [self.mirrorlist]

Incidentally since you control what self._anacondabaseurls gets set to,
you could add a check to the setter to make sure it's always set to a
list.

> @@ -475,6 +488,9 @@ class AnacondaYum(YumSorter):
>              return
>  
>          # add default repos
> +        anacondabaseurl = (self.anaconda.methodstr or
> +                           "cdrom:%s" % (self.anaconda.mediaDevice))
> +        anacondabasepaths = self.anaconda.id.instClass.getPackagePaths(anacondabaseurl)
>          for (name, uri) in self.anaconda.id.instClass.getPackagePaths(self._baseRepoURL).items():
>              rid = name.replace(" ", "")
>  

See my previous comment about the format of the method parameter when
referring to a CD device.

Anyway, is this a valid assumption here?  Have you ensured that you can
never get to this point without your two choices being (1) having a
methodstr, or (2) installing from a CD/DVD?  In the code right now, it's
very possible to have neither of these be the case, since in
configBaseURL you can hit that situation.  What that means is that you
didn't provide any method=/repo= parameter on the command line AND that
you are not installing from media.  So, basically you're booting off
boot.iso and using the default mirror list.

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux