New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed the default behaviour of the autopartitioning (#1380767) #941
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ | |
# Some of the code here is copied from pyanaconda/ui/gui/spokes/storage.py | ||
# which has the same license and authored by David Lehman <dlehman@redhat.com> | ||
# | ||
|
||
from pyanaconda.iutil import firstNotNone | ||
from pyanaconda.ui.lib.disks import getDisks, applyDiskSelection, checkDiskSelection | ||
from pyanaconda.ui.categories.system import SystemCategory | ||
from pyanaconda.ui.tui.spokes import NormalTUISpoke | ||
|
@@ -37,20 +37,20 @@ | |
from pyanaconda.flags import flags | ||
from pyanaconda.kickstart import doKickstartStorage, resetCustomStorageData | ||
from pyanaconda.threads import threadMgr, AnacondaThread | ||
from pyanaconda.constants import THREAD_STORAGE, THREAD_STORAGE_WATCHER, THREAD_DASDFMT, DEFAULT_AUTOPART_TYPE | ||
from pyanaconda.constants import THREAD_STORAGE, THREAD_STORAGE_WATCHER, THREAD_DASDFMT | ||
from pyanaconda.constants_text import INPUT_PROCESSED | ||
from pyanaconda.i18n import _, P_, N_, C_ | ||
from pyanaconda.bootloader import BootLoaderError | ||
|
||
from pykickstart.constants import CLEARPART_TYPE_ALL, CLEARPART_TYPE_LINUX, CLEARPART_TYPE_NONE, AUTOPART_TYPE_LVM | ||
from pykickstart.constants import CLEARPART_TYPE_ALL, CLEARPART_TYPE_LINUX, CLEARPART_TYPE_NONE | ||
from pykickstart.errors import KickstartValueError | ||
|
||
from collections import OrderedDict | ||
|
||
import logging | ||
log = logging.getLogger("anaconda") | ||
|
||
__all__ = ["StorageSpoke", "AutoPartSpoke"] | ||
__all__ = ["StorageSpoke"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this change intentional? What is the purpose? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In tui, it does not make sense to enable automatic import of indirect spokes, because we always create them and use them only in other spokes. With automatic import, they will be found by a hub, created, initialized and forgotten. Also, I've added a new parameter to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the extra explanation. I think this deserves a separate commit or at least some explanation in the commit message, though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed. |
||
|
||
CLEARALL = N_("Use All Space") | ||
CLEARLINUX = N_("Replace Existing Linux system(s)") | ||
|
@@ -93,6 +93,10 @@ def __init__(self, app, data, storage, payload, instclass): | |
# default to using autopart for interactive installs | ||
self.data.autopart.autopart = True | ||
|
||
# Set the default partitioning scheme. | ||
self.default_autopart_type = firstNotNone((self.data.autopart.type, | ||
self.instclass.default_autopart_type)) | ||
|
||
@property | ||
def completed(self): | ||
retval = bool(self.storage.rootDevice and not self.errors) | ||
|
@@ -290,8 +294,8 @@ def input(self, args, key): | |
# proceed. | ||
return None | ||
|
||
newspoke = AutoPartSpoke(self.app, self.data, self.storage, | ||
self.payload, self.instclass) | ||
newspoke = AutoPartSpoke(self.app, self.data, self.storage, self.payload, | ||
self.instclass, self.default_autopart_type) | ||
self.app.switch_screen_modal(newspoke) | ||
self.apply() | ||
self.execute() | ||
|
@@ -376,7 +380,7 @@ def apply(self): | |
self.data.clearpart.drives = self.selected_disks[:] | ||
|
||
if self.data.autopart.type is None: | ||
self.data.autopart.type = AUTOPART_TYPE_LVM | ||
self.data.autopart.type = self.default_autopart_type | ||
|
||
if self.autopart: | ||
self.clearPartType = CLEARPART_TYPE_ALL | ||
|
@@ -474,10 +478,11 @@ class AutoPartSpoke(NormalTUISpoke): | |
title = N_("Autopartitioning Options") | ||
category = SystemCategory | ||
|
||
def __init__(self, app, data, storage, payload, instclass): | ||
def __init__(self, app, data, storage, payload, instclass, default_autopart_type): | ||
NormalTUISpoke.__init__(self, app, data, storage, payload, instclass) | ||
self.clearPartType = self.data.clearpart.type | ||
self.parttypelist = sorted(PARTTYPES.keys()) | ||
self.default_autopart_type = default_autopart_type | ||
|
||
@property | ||
def indirect(self): | ||
|
@@ -521,8 +526,8 @@ def input(self, args, key): | |
except ValueError: | ||
# TRANSLATORS: 'c' to continue | ||
if key.lower() == C_('TUI|Spoke Navigation', 'c'): | ||
newspoke = PartitionSchemeSpoke(self.app, self.data, self.storage, | ||
self.payload, self.instclass) | ||
newspoke = PartitionSchemeSpoke(self.app, self.data, self.storage, self.payload, | ||
self.instclass, self.default_autopart_type) | ||
self.app.switch_screen_modal(newspoke) | ||
self.apply() | ||
self.close() | ||
|
@@ -540,13 +545,13 @@ class PartitionSchemeSpoke(NormalTUISpoke): | |
title = N_("Partition Scheme Options") | ||
category = SystemCategory | ||
|
||
def __init__(self, app, data, storage, payload, instclass): | ||
def __init__(self, app, data, storage, payload, instclass, default_autopart_type): | ||
NormalTUISpoke.__init__(self, app, data, storage, payload, instclass) | ||
self.partschemes = OrderedDict() | ||
pre_select = self.data.autopart.type or DEFAULT_AUTOPART_TYPE | ||
|
||
for i, item in enumerate(AUTOPART_CHOICES): | ||
self.partschemes[item[0]] = item[1] | ||
if item[1] == pre_select: | ||
if item[1] == default_autopart_type: | ||
self._selection = i | ||
|
||
@property | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also describe this particular change in the commit message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.