unattended: Move the windows method=cdrom logic into installer
And warn about it. This isn't triggerable at the moment due to virt-install hackery but that will change
This commit is contained in:
parent
a9d33d49db
commit
1e8f2413d7
|
@ -230,15 +230,21 @@ class Installer(object):
|
||||||
if self._treemedia.is_network_url():
|
if self._treemedia.is_network_url():
|
||||||
url = self.location
|
url = self.location
|
||||||
os_media = self._treemedia.get_os_media(guest, meter)
|
os_media = self._treemedia.get_os_media(guest, meter)
|
||||||
|
injection_method = "initrd"
|
||||||
else:
|
else:
|
||||||
if self.conn.is_remote():
|
if self.conn.is_remote():
|
||||||
raise RuntimeError("Unattended method=cdrom installs are "
|
raise RuntimeError("Unattended method=cdrom installs are "
|
||||||
"not yet supported for remote connections.")
|
"not yet supported for remote connections.")
|
||||||
|
if not guest.osinfo.is_windows():
|
||||||
|
logging.warning("Attempting unattended method=cdrom injection "
|
||||||
|
"for a non-windows OS. If this doesn't work, try "
|
||||||
|
"passing install media to --location")
|
||||||
osguess = OSDB.guess_os_by_iso(self.cdrom)
|
osguess = OSDB.guess_os_by_iso(self.cdrom)
|
||||||
os_media = osguess[1] if osguess else None
|
os_media = osguess[1] if osguess else None
|
||||||
|
injection_method = "cdrom"
|
||||||
|
|
||||||
return unattended.prepare_install_script(
|
return unattended.prepare_install_script(
|
||||||
guest, self._unattended_data, url, os_media)
|
guest, self._unattended_data, url, os_media, injection_method)
|
||||||
|
|
||||||
def _prepare(self, guest, meter):
|
def _prepare(self, guest, meter):
|
||||||
unattended_script = None
|
unattended_script = None
|
||||||
|
|
|
@ -233,7 +233,7 @@ def _find_default_profile(profile_names):
|
||||||
return found or profile_names[0]
|
return found or profile_names[0]
|
||||||
|
|
||||||
|
|
||||||
def _lookup_rawscript(guest, profile, os_media):
|
def _lookup_rawscript(osinfo, profile, os_media):
|
||||||
script_list = []
|
script_list = []
|
||||||
|
|
||||||
if os_media:
|
if os_media:
|
||||||
|
@ -242,18 +242,18 @@ def _lookup_rawscript(guest, profile, os_media):
|
||||||
# don't support unattended installs
|
# don't support unattended installs
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
_("OS '%s' media does not support unattended "
|
_("OS '%s' media does not support unattended "
|
||||||
"installation") % (guest.osinfo.name))
|
"installation") % (osinfo.name))
|
||||||
|
|
||||||
# In case we're dealing with a media installation, let's try to get
|
# In case we're dealing with a media installation, let's try to get
|
||||||
# the installer scripts from the media, in case any is set.
|
# the installer scripts from the media, in case any is set.
|
||||||
script_list = os_media.get_install_script_list()
|
script_list = os_media.get_install_script_list()
|
||||||
|
|
||||||
if not script_list:
|
if not script_list:
|
||||||
script_list = guest.osinfo.get_install_script_list()
|
script_list = osinfo.get_install_script_list()
|
||||||
if not script_list:
|
if not script_list:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
_("OS '%s' does not support unattended installation.") %
|
_("OS '%s' does not support unattended installation.") %
|
||||||
guest.osinfo.name)
|
osinfo.name)
|
||||||
|
|
||||||
script_map = _make_scriptmap(script_list)
|
script_map = _make_scriptmap(script_list)
|
||||||
profile_names = list(sorted(script_map.keys()))
|
profile_names = list(sorted(script_map.keys()))
|
||||||
|
@ -263,7 +263,7 @@ def _lookup_rawscript(guest, profile, os_media):
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
_("OS '%s' does not support unattended installation for "
|
_("OS '%s' does not support unattended installation for "
|
||||||
"the '%s' profile. Available profiles: %s") %
|
"the '%s' profile. Available profiles: %s") %
|
||||||
(guest.osinfo.name, profile, ", ".join(profile_names)))
|
(osinfo.name, profile, ", ".join(profile_names)))
|
||||||
else:
|
else:
|
||||||
profile = _find_default_profile(profile_names)
|
profile = _find_default_profile(profile_names)
|
||||||
logging.warning(_("Using unattended profile '%s'"), profile)
|
logging.warning(_("Using unattended profile '%s'"), profile)
|
||||||
|
@ -279,7 +279,8 @@ def _lookup_rawscript(guest, profile, os_media):
|
||||||
return usescript
|
return usescript
|
||||||
|
|
||||||
|
|
||||||
def prepare_install_script(guest, unattended_data, url, os_media):
|
def prepare_install_script(guest, unattended_data,
|
||||||
|
url, os_media, injection_method):
|
||||||
def _get_installation_source(os_media):
|
def _get_installation_source(os_media):
|
||||||
# This is ugly, but that's only the current way to deal with
|
# This is ugly, but that's only the current way to deal with
|
||||||
# netinstall medias.
|
# netinstall medias.
|
||||||
|
@ -289,12 +290,10 @@ def prepare_install_script(guest, unattended_data, url, os_media):
|
||||||
return "network"
|
return "network"
|
||||||
return "media"
|
return "media"
|
||||||
|
|
||||||
rawscript = _lookup_rawscript(guest, unattended_data.profile, os_media)
|
rawscript = _lookup_rawscript(guest.osinfo,
|
||||||
|
unattended_data.profile, os_media)
|
||||||
script = OSInstallScript(rawscript, guest.osinfo)
|
script = OSInstallScript(rawscript, guest.osinfo)
|
||||||
|
|
||||||
# For all tree based installations we're going to perform initrd injection
|
|
||||||
# and install the systems via network.
|
|
||||||
injection_method = "cdrom" if guest.osinfo.is_windows() else "initrd"
|
|
||||||
script.set_preferred_injection_method(injection_method)
|
script.set_preferred_injection_method(injection_method)
|
||||||
|
|
||||||
installationsource = _get_installation_source(os_media)
|
installationsource = _get_installation_source(os_media)
|
||||||
|
|
Loading…
Reference in New Issue