Cole Robinson
e47b34c05a
Fix initrdinject and urltests with py3
...
A few random issues scattered about
2018-02-06 18:56:15 -05:00
Cole Robinson
3086c7fda9
Drop python3 compat imports
...
We are going completely python3
2018-02-06 18:56:15 -05:00
Cole Robinson
e90d728380
urlfetcher: Open local files as binary
...
Needed for proper functioning on python3
2018-02-06 18:49:17 -05:00
Radostin Stoyanov
6de65ab328
urlfetcher: Python 2/3 compatability for 'urllib'
...
The `urllib2` module has been split across several modules in Python 3
named `urllib.request` and `urllib.error`. [1]
[1] https://docs.python.org/2.7/library/urllib2.html
2018-02-06 18:49:17 -05:00
Radostin Stoyanov
978fb25ac7
Wrap keys(), values() in a list
...
In Python 3 dict.values() [1] , dict.keys() [2] and dict.items() [3]
return a view [4] of the dictionary’s values, keys and items.
In Python 2 these functions return a list. [5] [6] [7]
To resolve this we can convert the result of these function to a list.
[1] https://docs.python.org/3/library/stdtypes.html#dict.values
[2] https://docs.python.org/3/library/stdtypes.html#dict.keys
[3] https://docs.python.org/3/library/stdtypes.html#dict.items
[4] https://docs.python.org/3/library/stdtypes.html#dict-views
[5] https://docs.python.org/2/library/stdtypes.html#dict.items
[6] https://docs.python.org/2/library/stdtypes.html#dict.keys
[7] https://docs.python.org/2/library/stdtypes.html#dict.values
2018-02-06 18:49:17 -05:00
Radostin Stoyanov
810ee09292
Replace ConfigParser with configparser
...
The ConfigParser module has been renamed to configparser in
Python 3. [1] Backport of this changes is also available for
Python 2. [2]
[1] https://docs.python.org/2/library/configparser.html
[2] https://pypi.python.org/pypi/configparser/3.2.0r3
2018-02-06 18:49:17 -05:00
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