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
Fixed the default behaviour of the autopartitioning (#1380767) #941
Conversation
e07325b
to
4576899
Compare
Great +1 for this! |
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.
Looks nice to me otherwise.
@@ -290,7 +290,7 @@ def execute(self, storage, ksdata, instClass): | |||
|
|||
# sets up default autopartitioning. use clearpart separately | |||
# if you want it | |||
instClass.setDefaultPartitioning(storage) | |||
refreshAutoSwapSize(storage) |
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.
pyanaconda/installclass.py
Outdated
@@ -58,6 +58,10 @@ class BaseInstallClass(object): | |||
# Blivet uses by default. | |||
defaultFS = None | |||
|
|||
# The default partitioning scheme to use for autopartitioning. | |||
# If None, we will use DEFAULT_AUTOPART_TYPE. |
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.
Why is it being set to None
then?
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.
I could change None
to DEFAULT_AUTOPART_TYPE
, but then it is not necessary to have the constant DEFAULT_AUTOPART_TYPE
at all, because it will be used only here.
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.
Still better to have a constant for this -- for other installclasses, addons,...
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.
pyanaconda/iutil.py
Outdated
"""Return the first argument that is not None.""" | ||
for arg in args: | ||
if arg is not None: | ||
return arg |
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.
This whole function can be written as:
return next((arg for arg in args if arg is not None), None)
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.
And if it is a function, it should be generic -- i.e. take any iterable as a single argument and return the first item that is not None. AFAICT there's no need to use *args
machinery here.
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.
I've seen this implementation before, but it is really hard to read. What are the advantages?
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.
I can make the function generic, though.
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.
There's no advantage, it just looks more "pythonic", whatever that means. :) Feel free to leave the for cycle in place. My main concern here is the (non-)genericity.
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.
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 comment
The 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 comment
The 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 AutoPartSpoke.__init__
method and the initialization in a hub does not work anymore.
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.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
4576899
to
f56e920
Compare
The default partitioning of the installclass should be always set. Then it is not necessary to set it again, but always refresh the size of swap before autopartitioning. Resolves: rhbz#1380767
The default partitioning scheme can be defined in an install class. If the kickstart file defines the scheme, it will be used instead. Resolves: rhbz#1380767
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.
f56e920
to
722dd3e
Compare
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.
Looks good to me.
Always set the default partitioning
Enable to define the autopart type in an install class
If the kickstart file defines the scheme, it will be used instead.
Resolves: rhbz#1380767