28 Commits

Author SHA1 Message Date
Cole Robinson
de90716eb4 unattended: Choose a default profile name if none specified
We default to 'desktop' if none specified, otherwise we choose the
first alphabetical profile available. Make bare '--unattended' a
valid option
2019-06-11 17:55:09 -04:00
Cole Robinson
034d112181 unattended: Finish off code coverage testing 2019-06-11 17:55:09 -04:00
Cole Robinson
b4c9e4b114 tests: Skip unattended tests unless osinfo is new enough 2019-06-09 20:19:45 -04:00
Cole Robinson
4dd12e2e56 installer: Generate the unattended script only in installer
And pass it down to treemedia, which acts on our script wrapper
object. This is conceptually a bit simpler because we can see in
one place what data feeds the script build process, depending on
installer props
2019-06-09 20:19:42 -04:00
Cole Robinson
b3a9b98e08 osdict: Standardize on OsMedia usage
* Make all API calls go through the _OsMedia object
* Move most of the unattended specific processing to unattended.py
* Rename requires_internet to is_netinst to clarify what it is checking
2019-06-09 11:26:28 -04:00
Cole Robinson
f6a4326a9a unattended: Drop glib/gio usage
Use native python lib bits to do timezone and locale lookup
2019-06-09 09:50:28 -04:00
Cole Robinson
d3b20b16d0 unattended: Don't use custom subdir for storing tempfiles
The reason this was done, is because we need to inject files with
certain names into the initrd/cdrom media so the guest OS can find
them, but our injection infrastructure didn't have the knowledge
necessary to rename files at injection time.

Having to deal with the subdir complicates cleanup and unattended
data generation, so let's do away with it. Teach the injection
bits about renaming, and adjust all the related bits to use
standard tempdirs
2019-06-08 15:25:12 -04:00
Cole Robinson
3495a8f1f9 unattended: Share more script generation bits
- Break out the installer* unattended prep to its own function
- Move logging into common unattended call
- Use libosinfo APIs to generate script str, then we write it
- Move commandline lookup to installertreemedia
- Rename path->scriptpath for clarity
2019-06-08 14:16:52 -04:00
Cole Robinson
c2de4d7c36 util: Move get_cache_dir to VirtinstConnection
Renaming it get_app_cache_dir so it doesn't conflict with get_cache_dir
usage in virtManager
2019-06-07 17:53:15 -04:00
Cole Robinson
e6262435d6 unattended: Move gi require_version to virtinst import
Otherwise depending on import order this bit needs to be moved around
2019-06-07 17:45:21 -04:00
Fabiano Fidêncio
fd5bd5d90f installer: Prefer "cdrom" over "floppy"
Instead of using "floppy" as the way to perform unattended installations
for Windoes, let's prefer using "cdrom" instead.

The main reasons behind this change are:
- VMs using q35 may have floppy device disabled in some systems;
- We can drop mstools dependency;

Generating the ISO depends on genisofs, tho. However, it's not a big
deal as genisofs is already a virt-manager dependency.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-06-07 13:41:57 -04:00
Fabiano Fidêncio
98bd275969 unattended: Do not create a "unattended" dir
Let's just use mktemp() as done in several other places and avoid the
risk of having the content of the folder overwritten in case of parallel
installations.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-06-07 13:41:57 -04:00
Fabiano Fidêncio
1ead62964c unattended: Adapt for Windows
The main differences are:
- Windows unattended installation will be performed via "floppy"
  injection instead of "initrd";
- Windows target disk must be a letter ("C", in our case);
- Windows requires a product-key to be passed

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-04-01 16:28:52 -04:00
Fabiano Fidêncio
5de172501c unattended: Add product-key to Unattended data
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-04-01 16:28:52 -04:00
Fabiano Fidêncio
3f6e11ec05 unattended: Take advantage of OsinfoMedia.requires_internet()
By using OsinfoMedia.requires_internet() we ensure this logic is not
spread in our codebase and also keep _OsinfoIter internal to osdict.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-28 15:56:44 -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
Fabiano Fidêncio
93d3223c87 unattended: Pass the media down to get_install_script()
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-08 17:11:10 -05:00
Fabiano Fidêncio
eae4ff3b42 unattended: Properly set the installation source
The installation source, which can be either "media" or "network",
should be properly set depending on whether we're installing from a
media or performing a tree based installation.

We have to mind here that any media that is set as "netinstall" variant
has to have its installation source set accordingly.

An different approach for this would be to generate the script
specifically from the media whenever a media is passed. However, IMO, it
would just add two new codepaths and having the media passed around
without a real gain against the method chosen.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-08 17:10:41 -05:00
Fabiano Fidêncio
0d4f50d001 installertreemedia: Pass media down to prepare_install_script()
Let's pass the media down to prepare_install_script() as it'll be used
to:
- select the preferred installation source;
- be passed down to the get_install_script() method;

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-08 17:04:40 -05:00
Cole Robinson
9c5d252a2c unattended: bump minimum version based on set_installation_url
And silence pylint warnings on older libosinfo
2019-03-08 16:57:40 -05:00
Fabiano Fidêncio
f49e49a560 installertreemdia: Set user specified --location as the installer URL
The location has to be passed down to the generate_install_script()
method whenever a tree based installation is being performed.

Although Libosinfo provides information about the URL to be used when
performing a tree based installation, cases where the users prefer to
use, for any specific reason, their own URLs should be covered as well.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-08 16:55:42 -05:00
Cole Robinson
1f6879c811 unattended: Split out make_installconfig
The building process here is mostly independent of the InstallScript
object. Moving it to its own function makes that more clear, makes
InstallScript smaller, and the code is indented less
2019-03-05 16:38:22 -05:00
Cole Robinson
e87e3a71fe unattended: Improve some error reporting
* Explicitly error if libosinfo is too old
* Fix an error string
* disable pylint errors on old libosinfo
2019-03-05 16:38:22 -05:00
Cole Robinson
5126694fa7 unattended: Add generate_install_script
Split out from prepare_install_script. Makes things easier to
unit test.
2019-03-05 16:38:22 -05:00
Cole Robinson
0031d15098 virtinst: move OSInstallScript to unattended
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-03-05 16:38:22 -05:00
Cole Robinson
6537659ea6 osdict: Add OSInstallScript class
To wrap Libosinfo.InstallScript interactions
2019-03-05 16:38:22 -05:00
Fabiano Fidêncio
e5e0c33156 unattended: Add helper method to generate the install script
generate_install_script() is a helper that will do all the needed
plumbing related to create, populating and generating the install script
and its config.

The method returns the path to the generated install script and the
kernel command line to be used with it.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-05 16:38:22 -05:00
Fabiano Fidêncio
e8893f2178 virt-install: Add --unattended
--unattended is currently a no-op parameter that will be used to perform
unattended installations.

For now, if someone tries to use --unattended virt-install will fail as
the option is still not supported.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-05 16:38:22 -05:00