Commit Graph

61 Commits

Author SHA1 Message Date
Cole Robinson
550e8f243c Fix pylint 'Unnecessary pass statement' 2019-04-14 20:22:56 -04:00
Fabiano Fidêncio
467cb9bc0a urldetect: return osdict.py:OsMedia instead of Libosinfo.Media
Consequently, let's:
- rename urldetect::get_osinfo_media() to get_os_media()
- rename the installertreemedia::_LocationData::osinfo_media to os_media
- rename unattended::prepare_install_script's media argument to os_media
  - and also rename media to os_media on its internal
    _get_installation_source() method
- rename osdict::get_install_script's media argument to os_media

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-28 15:56:44 -04:00
Cole Robinson
3be238b03e tests: test_urls: Add --*libosinfo, --iso-only, --url-only
These are options that will help tweak the test_urls logic,
to help as we try to ensure libosinfo covers all the cases
we care about.
2019-03-24 12:32:03 -04:00
Cole Robinson
97a5af1e43 urldetect: Use libosinfo for tree detection too
Ask libosinfo for tree detection, but still fall back to our
own implementation if libosinfo fails
2019-03-24 12:27:46 -04:00
Cole Robinson
74bbc3db15 urldetect: Check also for 'treeinfo' (bz 1689252)
Trees published to akamai CDN via Red Hat Satellite can't have .dotfiles
in them. More details here:

  https://bugzilla.redhat.com/show_bug.cgi?id=635065

So we also need to check for .treeinfo. Anaconda does this too so it's
a long known issue.

https://bugzilla.redhat.com/show_bug.cgi?id=1689252
2019-03-18 14:24:07 -04:00
Cole Robinson
b2402b278a installtreemedia: Grab libosinfo media from urldetect
This will be needed for upcoming unattended changes
2019-03-08 17:01:26 -05:00
Cole Robinson
4cf7e0066f urldetect: Always put libosinfo detection first
Even if we are shortcircuiting based on a passed os-variant value,
osinfo always gets priority
2019-03-08 16:54:57 -05:00
Cole Robinson
39590c4d1c urldetect: Move the store lookup shortcircuiting
...to _build_distro_list()
2019-03-08 16:54:26 -05:00
Cole Robinson
9688815237 urldetect: Rework _allstores building a bit
Rename it ALLSTORES since it's a global variable
Split out the building from the altering
2019-03-08 16:52:33 -05:00
Cole Robinson
39bb8968d0 virt-install: add --location LOCATION,kernel=X,initrd=X
Add kernel= and initrd= --location suboptions. These can be
used to override the default kernel/initrd and specify new
paths, relative to LOCATION.

For example, if you have an ISO that libosinfo doesn't know
about called my-unknown.iso, with a kernel at 'kernel/fookernel'
and initrd at +'kernel/fooinitrd', you can make this work with:

--location my-unknown.iso,kernel=kernel/fookernel,initrd=kernel/fooinitrd
2019-02-03 12:05:18 -05:00
Cole Robinson
f035f313a4 osdict: Absorb get_kernel_url_arg from urldetect
Since nowadays it's entirely a function of the detected OS name
2019-02-03 12:05:18 -05:00
Cole Robinson
41b276ffcd installertreemedia: Don't carry around _Distro internally
Detect the distro, and pull out all the data we need into an internal
cache. This will simplify future improvements
2019-02-03 12:05:18 -05:00
Cole Robinson
b4cddb338b urldetect: Fix rhel8 detection
Internally rhel8 versions are now 8.0.0, so adjust our version check
2019-02-03 12:05:18 -05:00
Cole Robinson
665607fdc2 urldetect: Add a class for libosinfo detection
If an ISO path is used for --location, prioritize asking libosinfo
for the os_variant and kernel/initrd paths.

This fixes some instances that we lost when GenericDistro was dropped,
like using various netinst/boot.isos around

Example: https://github.com/virt-manager/virt-manager/pull/39
2019-02-03 12:05:18 -05:00
Cole Robinson
3d8b41c7bb urldetect: Renaming Distro to _DistroTree
And all child distros to match. 'Distro' is too generic, and
now they can be made private
2019-02-03 12:05:18 -05:00
Cole Robinson
9995ebc86b urldetect: Kill acquireKernel
Decompose it into a helper to probe for available kernel paths, but leave
the actual file fetching up to the installer class
2019-02-03 12:05:18 -05:00
Cole Robinson
e2edcc559d urldetect: Fix comment typo 2019-02-03 12:05:18 -05:00
Cole Robinson
012a4e8ef5 urldetect: Centralize _get_kernel_url_arg implementation
Future changes will make more use of libosinfo, which means we
won't end up in some of the *Distro classes. So move the
get_kernel_url_arg logic into the parent Distro class, so it's
more easily shared.
2019-02-03 12:05:18 -05:00
Cole Robinson
66e89f020b urldetect: rename _set_kernel_paths to _set_manual_kernel_paths 2019-02-03 12:05:18 -05:00
Cole Robinson
a7be538003 urldetect: Centralize setting _kernel_paths from treeinfo 2019-02-03 12:05:18 -05:00
Cole Robinson
79345369a7 urldetect: Add _set_kernel_paths class override
All __init__ calls essentially are just filling in _kernel_paths.
Make it explicit
2019-02-03 12:05:18 -05:00
Christian Borntraeger
c82042245b virt-install: fix SLES11 installation on s390x
self._os_variant returns sles11sp4 sles11sp3 and so on.
Lets match those as well to pickup the right kernels.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
2019-01-21 15:41:24 -05:00
Cole Robinson
c38be50dcb urldetect: Use fedora-unknown more
Instead of the magic to look up latest OS... fedora-unknown is meant
for that usecase.
2019-01-08 16:02:34 -05:00
Cole Robinson
2f89ecf4a9 Remove Author lines from file headers
Similar to what was done in libvirt. See these commits:

600462834f
c99e954973
2019-01-08 11:45:35 -05:00
Fabiano Fidêncio
7612c5bdcd osdict: expand the "unknown" check for any distro
Currently osinfo-db has "unknown" entries for fedora, opensuse and
asianux. Considering this list may grow even more at some point, let's
just make the check more generic and use it for all of them instead of
keeping it for fedora only.

Changes have also been done in urldetect and tests_url, as those also
used latest_fedora_version().

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2018-12-05 15:04:59 +01:00
Cole Robinson
25b8873340 urldetect: Don't overload suse_content variable
Use an explicit check_for_suse_content variable rather than
stuffing -1 into suse_content
2018-10-18 17:16:14 -04:00
Johannes Tiefenbacher
b8aff28087 virtinst: quickfix ubuntu net-preseed insert cdrom error
the proper kernel/initrd pair for booting from an http server is found in install/netboot/... on a mounted ubuntu iso.
this last worked in v1.4.2

Discussion: https://github.com/virt-manager/virt-manager/pull/34

(crobinso: add the fetcher.is_iso handling and add a comment)
2018-10-18 13:21:41 -04:00
Cole Robinson
8ff2043f2a urldetect: Drop boot.iso fetching
Since this was only used for the --cdrom $treeurl case, this is
no longer used
2018-10-12 15:54:39 -04:00
Cole Robinson
4adb1c8c30 pycodestyle: fix W605 invalid escape sequence 2018-09-29 13:59:19 -04:00
Cole Robinson
6063538750 guest: Replace os_variant with set_os_name
And have callers directly access osinfo.name if they need it
2018-09-12 17:24:28 -04:00
Cole Robinson
4e63267a4f urldetect: Rename urldistro to matching_distros
Allow store classes to track multiple matching types, and use this
to ditch the custom urldistro logic in osdict altogether
2018-09-01 13:23:01 -04:00
Cole Robinson
65b33a1377 urldetect: Fix some pylint 2018-05-16 19:31:50 -04:00
Charles Arnold
3fd538ba0f Make SuseDistro a base class for other Suse classes
Remove the PRETTY_NAME for SuseDistro so it isn't included in the allstores.

Add appropriate identifiers to the other Suse classes so that they
are included in allstores.

If cache.treeinfo_family_regex fails to find the family but there is
a .treeinfo file, self.cache.suse_content is set to -1 when a failed
attempt is made to find a content file. Check for -1 in the __init__
function so we will pull the kernel from the location in .treeinfo file.

Signed-off-by: Charles Arnold <carnold@suse.com>
2018-05-16 19:25:32 -04:00
Charles Arnold
26b8bb0f0b Use wildcard to detect 'openSUSE Leap'.
Old versions of the string from the content file end with just "openSUSE".
openSUSE 42.x has a string of "openSUSE Leap ". Cleanup extra whitespace
for old versions of openSUSE.

Signed-off-by: Charles Arnold <carnold@suse.com>
2018-05-16 19:25:32 -04:00
Charles Arnold
e6fd723c46 Use split_version method to get version and update
The while loop that follows is similar to rhel code but because the osinfo-db
short id for sles doesn't contain a '.0' for first time releases (eg, sles11,
sles12) we check sle with no update and don't add a '.0' to the string.

Signed-off-by: Charles Arnold <carnold@suse.com>
2018-05-16 19:25:32 -04:00
Charles Arnold
ab7209cb6c Create shared function _split_version from _split_rhel_version
This new function will be used for for rhel and sles detection.

Signed-off-by: Charles Arnold <carnold@suse.com>
2018-05-16 19:25:32 -04:00
Daniel P. Berrangé
b1460ba065 Chagne most URIs to use https:// instead of http://
All URLs were checked to see if they supported https://, those which did
were converted.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-30 13:35:39 -04:00
Cole Robinson
d81a9a0bc0 urldetect: suse tumbleweed now has .treeinfo file 2018-04-24 11:56:02 -04:00
Cole Robinson
f00601fade urldetect: don't overwrite self.arch with suse content arch
They are different, so label it as tree_arch
2018-04-24 11:34:57 -04:00
Cole Robinson
3b74d3036a urldetect: Split out treeinfo logic from GenericTreeInfo
SUSE distros will be growing treeinfo support soon and trying to handle
this logic through class inheritance is difficult, so separate the
logic into its own function
2018-04-24 11:34:57 -04:00
Cole Robinson
a9c5890d72 urldetect: Drop a bunch of RH version integer handling
It's not really required
2018-04-24 11:34:57 -04:00
Cole Robinson
568841835d urldetect: Standardize _detect_version naming
This is the hook that subclasses use to save a detect os_variant value
2018-04-24 11:34:53 -04:00
Cole Robinson
dc3e157471 urldetect: Clean up opensuse variant detection
Make the logic easier to follow
2018-04-24 11:33:12 -04:00
Cole Robinson
cba909d593 urldetect: Drop unused uses_treeinfo 2018-04-24 11:33:12 -04:00
Daniel P. Berrangé
48e32b429d Fix copyright header to specify GPLv2 or later, not GPLv2 only.
The copyright headers in every file were chjanged in this previous commit

  commit b6dcee8eb7
  Author: Cole Robinson <crobinso@redhat.com>
  Date:   Tue Mar 20 15:00:02 2018 -0400

    Use consistent and minimal license header for every file

Where before this they said "

  "either version 2 of the License, or (at your option) any later version."

Now they just say

  "GNU GPLv2"

This fixes it to say "GNU GPLv2 or later" again.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-04 16:51:37 -04:00
Cole Robinson
96645fe3ed urldetect: Remove some unused SUSE bits
Charles confirmed for me that SUMMARY and arch fallback handling
doesn't have any still relevant uses, so we can drop them
2018-04-04 16:46:29 -04:00
Cole Robinson
76c40d6f97 urldetect: Track SUSE regexs in their Distro classes 2018-04-02 18:46:24 -04:00
Cole Robinson
467425fad1 urldetect: Move SUSE content file handling into its own class
Try to untangle the interdependencies and not recalculate everything
for every suse distro
2018-04-02 18:33:07 -04:00
Cole Robinson
fb1b26c081 urldetect: Drop RedHatDistro baseclass
Just fold the minimal logic into GenericTreeinfo, since only
RH distros use treeinfo so it's basically the same thing
2018-04-02 17:18:17 -04:00
Cole Robinson
eafdaf8b48 tests: test_urls: Add urldetect kernel arg validation 2018-04-02 17:15:05 -04:00