97 Commits

Author SHA1 Message Date
Cole Robinson
26046c5948 urlfetcher: Fix detection with latest ALT media 2018-01-06 14:04:34 -05:00
Cole Robinson
a183031793 urlfetcher: More debian CD arch handling 2018-01-06 14:04:34 -05:00
Andrew Wong
a7aa02ffa9 virtinst: Use isoinfo to extract files from ISOs and block devices 2018-01-06 14:02:11 -05:00
Andrew Wong
f836e47b70 virtinst: Fix _URLFetcher for reading files
_grabber() is used for both binary and text files.
2017-11-22 17:26:31 -05:00
Cole Robinson
374a3779c4 urlfetcher: Write test file as binary content
Triggers an test_ui error otherwise:

TypeError: write() argument must be str, not bytes
2017-10-21 19:41:33 -04:00
Chen Hanxiao
7f1b4cee82 pycodestyle: fix all E125 warnings
Fix all E125:
     Continuation line with same indent as next logical line

   Also remove ignore options of E125

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
2017-10-21 23:26:16 +08:00
Radostin Stoyanov
75210ed37c Replace StringIO with io.(StringIO or BytesIO)
StringIO and cStringIO modules no longer exists in Python 3. [1]
Use either io.StringIO [2] for text or io.BytesIO [3] for bytes.

[1] http://docs.python.org/3.0/whatsnew/3.0.html
[2] https://docs.python.org/3/library/io.html#text-i-o
[3] https://docs.python.org/3/library/io.html#binary-i-o
2017-10-20 13:18:31 -04:00
Radostin Stoyanov
63fce081ed pycodestyle: Use isinstance() for type checking
This is E721 in pycodestyle [1]:
   "do not compare types, use ‘isinstance()’"

The main differece between "type() is" and "isinstance()" is that
isinstance() supports inheritance. [1]

This can be seen in the example below:
    >>> type(True) is int
    False
    >>> isinstance(True, int)
    True

As we can see in python 'bool' a subclass of 'int'.

[1] https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes
[2] https://docs.python.org/2/library/functions.html#isinstance
2017-10-20 11:49:13 -04:00
Pavel Hrdina
c9a26c84b0 urlfetcher: fix kernel/initrd paths for Ubuntu install CD
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-10-04 12:32:17 +02:00
Jia He
3def27badd Add arm64 check to urlfetcher to cater for Debian based distro
Without this check, the virt-install will report:
RuntimeError: Couldn't find hvm kernel for Ubuntu tree.

Signed-off-by: Jia He <hejianet@gmail.com>
2017-10-04 09:53:28 +02:00
Viktor Mihajlovski
d2dce02522 virtinst: Add s390x cd detection for Debian
Enable the installation from Debian s390x CD images.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
2017-09-14 17:49:00 -04:00
Viktor Mihajlovski
5ce84fccf0 virtinst: Get rid of the s390x-specific cd detection function
Move the s390x-specific code into the generic cd detection function.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
2017-09-14 17:49:00 -04:00
Viktor Mihajlovski
6d38c3c457 virtinst: Fix cd recognition on Ubuntu
The Ubuntu c recognition was looking for a file .disk/mini-info.
However, the correct name is .disk/info.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
2017-09-14 17:49:00 -04:00
Chen Hanxiao
04e35b2d85 pycodestyle: fix all E124 warnings
Fix all E124:
     Closing bracket does not match visual indentation

   Also remove ignore options of E124

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
2017-09-09 23:21:42 +08:00
Andrew Wong
7fe62cedd5 virtinst: In DebianDistro and UbuntuDistro, detect Install CDs 2017-09-08 16:55:49 -04:00
Andrew Wong
08b269c25e virtinst: In DebianDistro and UbuntuDistro, refactor code for checking manifest and info files 2017-09-08 16:55:49 -04:00
Viktor Mihajlovski
f248088cc8 virtinst: adjust media paths for s390x
The install kernel and intrd files are located in <url-prefix>/generic
of the Debian and Ubuntu s390x install trees. Further they follow a
different naming scheme than on x86. Adjust the url fetching accordingly.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
2017-08-29 11:57:40 -04:00
Cole Robinson
e902fa5550 urlfetcher: force binary mode with FTP servers (bz #1462838) 2017-08-17 16:10:46 -04:00
Chen Hanxiao
c92aade081 pycodestyle: fix all E203 warnings
Fix all E203 whitespace before ':'
   Also remove E203 ignore option of pycodestyle

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
2017-08-11 00:01:38 +08:00
Radostin Stoyanov
b93cc3bbc9 pycodestyle: Do not use bare 'except:'
A bare 'except:' catches all exceptions [1], including SystemExit,
KeyboardInterrupt, and GeneratorExit (which is not an error and should
not normally be caught by user code). In situations where you need to
catch all “normal” errors, you can catch the base class for all normal
exceptions, Exception [2].

[1] https://docs.python.org/2/howto/doanddont.html#except
[2] https://docs.python.org/2/library/exceptions.html#Exception
2017-08-02 13:57:43 -04:00
Cole Robinson
4e7a6ad728 tests: pylint: Silence/fix a bunch of new warnings 2017-06-16 12:54:56 -04:00
Cole Robinson
87b37f3049 urlfetcher: More debugging around urldistro prioritizing
Plus we can always depend on guest.os_variant, so drop the check
2017-05-15 08:51:00 -04:00
Cole Robinson
f551d7e55d Replace file() usage with open()
Same semantics, but the latter is needed for python3
2017-05-05 14:53:12 -04:00
Cole Robinson
62feeb02a8 Switch to python3 style 'except X as Y' notation
Which also works with python2.7
2017-05-05 14:52:11 -04:00
Rowan Potgieter
a98b456975 Add x86_64 check to urlfetcher to cater for Ubuntu 16.04 2017-04-04 15:24:05 -04:00
Cole Robinson
10715eb50c urlfetcher: Fix incorrect comment
Added via 3f15a489cd when the code was reworked, but the default has
always been i386. Maybe we should change it to amd64, but it needs
testing. In the mean time, fix the comment.

Spotted at 3f15a489cd (commitcomment-20111744)
2016-12-13 14:37:16 -05:00
Cole Robinson
3f15a489cd urlfetcher: Fix ubuntu --location $iso arch detection
Reported here:
http://www.redhat.com/archives/virt-tools-list/2016-August/msg00009.html
2016-08-16 19:37:02 -04:00
Manjunath A Kumatagi
cd35470e3c Update initrd and kernel path for ppc64le platform.
In CentOS 7 ppc64le platform initrd and kernel files are present under ppc/ppc64 folder. Currently GenericDistro module will find only under images/pxeboot folder. So to support custom boot the CentOS 7 ppc64le platform I've added the code to search under ppc/ppc64 folder as well.
2016-08-16 18:52:20 -04:00
Charles Arnold
33ae6e51ad virtinst: Fix detection of sle12sp1 media
The installer wrongly detects SLE-12-SP1 media as SLE-12-GA

Signed-off-by: Charles Arnold <carnold@suse.com>
2016-06-07 11:01:09 -04:00
Charles Arnold
2647f699fb virtinst: Fix detection of openSUSE tumbleweed media
With Tumbleweed now part of libosinfo we do not need to default
to openSUSE 13.2 when pointing at the installation media.

Signed-off-by: Charles Arnold <carnold@suse.com>
2016-06-07 11:01:09 -04:00
Leno Hou
82432dc339 urlfetcher: Enable Ubuntu 16.04 s390x detection
Signed-off-by: Leno Hou <lenohou@gmail.com>
CC: Kevin Zhao <kevin.zhaoshuai@gmail.com>
2016-04-26 08:13:46 -04:00
Cole Robinson
f4dfb6de9d Fix recent pylint/pep8 output 2016-04-18 16:42:12 -04:00
Cole Robinson
f4bf4ef349 urlfetcher: Don't set os_variant=linux
os_variant=linux is basically meaningless; it doesn't set any useful
defaults. better to be explicit that we didn't detect any meaningful
os_variant, to trigger the virt-install warning
2016-04-07 17:43:53 -04:00
Cole Robinson
b45f676086 urlfetcher: Make fedora detection more robust 2016-04-07 17:29:42 -04:00
Cole Robinson
97b5961506 urlfetcher: Fix rawhide URL detection (bz 1322011) 2016-04-07 17:20:18 -04:00
Cole Robinson
c92507baea urlfetcher: Fix ftp URLs with ports in them
Reported-by: int-0 <tobias.deb@gmail.com>
2016-03-24 16:15:21 -04:00
Cole Robinson
d3b9fcf3de Fix some pylint 2016-03-24 16:04:06 -04:00
Cole Robinson
d32e5c7e27 urlfetcher: Support latest Mageia
The kernel paths changes
2016-03-24 15:57:34 -04:00
Cole Robinson
351e6b9562 urlfetcher: Fix detection of latest SL 6
They changes the treeinfo family to just be 'Scientific'
2016-03-24 15:57:34 -04:00
Cole Robinson
1c7a91385d urlfetcher: Fix distro detection with http->https redirects
Need to tell requests.head request to follow the redirect automatically,
otherwise the 301 response throws us off.

Saw this with http://d-i.debian.org/
2016-03-24 15:57:34 -04:00
Cole Robinson
af5a86742c urlfetcher: Add unconditional hasFile logging 2016-03-24 14:51:36 -04:00
Pavel Hrdina
4c3e7969c6 virt-install: concatenate all extra-args argument
So far we used only the last --extra-args argument from virt-install
command line, but it makes more sense to use all occurrences of
--extra-args and pass them to kernel.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-03-18 03:28:17 +01:00
Cole Robinson
eae7dc0619 urlfetcher: Fix URL installs when content-length header missing
Suggested-by: bduff@sjm.com
2016-01-12 12:45:02 -05:00
Cole Robinson
8700fda757 urlfetcher: Fix ubuntu url detection with latest libosinfo 2015-11-24 21:59:23 -05:00
Pavel Hrdina
4578a4ec0f virt-install: use correct path for linux and initrd for SLES on ppc64
Install DVD of SLES for ppc64 has different path where linux and initrd
are located.  Add those paths to kernel_paths to search also there, in
case we are installing SLES on ppc64 host.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-11-02 17:40:35 +01:00
Giuseppe Scrivano
c0a27bb9b4 urlfetcher: Recognize RHEL Atomic Host ISOs
Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1268001

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-10-05 21:54:30 +02:00
Cole Robinson
b520a659a3 urlfetcher: Add some debugging to debian distro detection 2015-09-23 18:21:26 -04:00
Cole Robinson
5584863d18 urlfetcher: Switch to requests and urllib2 instead of urlgrabber
urlgrabber is largely dead upstream and isn't going to be ported to
python3 AFAIK. So we will need to move off of it eventually.

Use requests for http handling which is the most common library nowadays,
and just plain old urllib2 for ftp fetching.
2015-09-18 19:50:35 -04:00
Cole Robinson
9a4f15f4ad urlfetcher: Rework early treeinfo lookup
We are duplicating the regex checks which I don't like. So just grab
the treeinfo early, and use that during the main distro lookup
2015-09-18 18:01:57 -04:00
Cole Robinson
b7beb0edb0 urlfetcher: Use python style tempfiles
Simplifies things WRT writing file contents
2015-09-18 17:11:37 -04:00