Bug 1782463

Summary: Guided partitioning 'shrink' and 'delete' actions cause a crash: "AttributeError: 'ResizeDialog' object has no attribute '_get_device'"
Product: [Fedora] Fedora Reporter: Adam Williamson <awilliam>
Component: anacondaAssignee: Vendula Poncova <vponcova>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: urgent Docs Contact:
Priority: urgent    
Version: rawhideCC: anaconda-maint-list, jkonecny, jonathan, kellin, pwhalen, robatino, vanmeeuwen+fedora, vponcova, wwoods
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: openqa
Fixed In Version: anaconda-32.17-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-12-14 18:47:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1705303    

Description Adam Williamson 2019-12-11 17:00:07 UTC
Since anaconda-32.16-1, any use of the 'shrink' or 'delete' actions in the guided partitioning 'reclaim space' path cause a crash:

19:41:47,601 DBG exception: running handleException
19:41:47,603 CRT exception: Traceback (most recent call last):

  File "/usr/lib64/python3.8/site-packages/pyanaconda/ui/gui/spokes/lib/resize.py", line 460, in _schedule_actions
    AutoPartitioningModule.remove_device(self, obj.name)

  File "/usr/lib64/python3.8/site-packages/pyanaconda/modules/storage/partitioning/automatic.py", line 196, in remove_device
    device = self._get_device(device_name)

AttributeError: 'ResizeDialog' object has no attribute '_get_device'

This is triggered by https://github.com/rhinstaller/anaconda/commit/8063c9f69bab876bde99af21e09e73a9b3564a89 . That commit isn't doing anything wrong, but because it makes AutoPartitioningModule.remove_device() and AutoPartitioningModule.shrink_device() call another of the class's methods - `self._get_device(device_name)` - it breaks these spectacularly ugly hacks in resize.py `ResizeDialog._schedule_actions()`:

        elif obj.action == _(SHRINK):
            # FIXME: This is an ugly temporary workaround for UI.
            AutoPartitioningModule.shrink_device(self, obj.name, obj.target)
        elif obj.action == _(DELETE):
            # FIXME: This is an ugly temporary workaround for UI.
            AutoPartitioningModule.remove_device(self, obj.name)

yep, it just wholesale steals methods from another class. This 'worked' while those methods were sort of self-contained, but now they're expecting to call another of AutoPartitioningModule's methods, it just blows up, because 'self' is not an AutoPartitioningModule, it's a ResizeDialog, and ResizeDialogs don't have a `_get_device()` method, like the error says.

I guess someone should've...FIXED ME 😎

Comment 1 Adam Williamson 2019-12-11 17:06:17 UTC
Proposing as a Beta blocker as a violation of Basic criterion "The installer must be able to complete an installation to a single disk using automatic partitioning.", with the footnote "It must work whether the disk is formatted or not and whether or not it contains any existing data - but before Beta, it's OK if it can only install to a disk with existing data by overwriting it." - this makes that not possible, as to install using 'automatic partitioning' to a 'single disk' with 'existing data' you must be able to delete it in this dialog.

Comment 2 Vendula Poncova 2019-12-11 17:38:43 UTC
Fixed in a pull request: https://github.com/rhinstaller/anaconda/pull/2249

Comment 3 Adam Williamson 2019-12-11 17:45:05 UTC
ahhhh! it's spreading! :P

thanks for the quick fixes.

Comment 4 Adam Williamson 2019-12-14 18:47:55 UTC
Confirmed fixed in latest Rawhide, thanks.