Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1064565 - handle missing anaconda-required packages
Summary: handle missing anaconda-required packages
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: anaconda
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: David Shea
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-02-12 20:38 UTC by Kay Williams
Modified: 2014-05-19 14:50 UTC (History)
4 users (show)

Fixed In Version: anaconda-21.33-1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-05-19 14:50:54 UTC


Attachments (Terms of Use)

Description Kay Williams 2014-02-12 20:38:03 UTC
Description of problem:
Anaconda adds a number of required packages at runtime based on user selections for storage, auth, ntp, etc. If one of the added packages is not included in the distribution (e.g. it is a custom distribution), anaconda raises an Unknown Error message and aborts.

Version-Release number of selected component (if applicable):
19.31.36

To assist with custom distribution creation, it would be preferable for anaconda to handle this error in a similar manner as it handles missing kickstart-specified packages/groups specified. Looking at the code, something like the following should suffice:

1. Modify noSuchPackage/Group handlers in pyanaconda/errors.py to distinguish
   between user-specified and anaconda-required packages/groups.

    def _noSuchGroupHandler(self, *args, **kwargs):
        group = args[0]
        anaconda_required = kwargs.pop("anaconda_required", False)
        if anaconda_required:
            message = _("Install requires the group '%s' but this group does "
                        "not exist.  This is a fatal error and installation "
                        "will be aborted.") % group
            self.ui.showError(message):
            return ERROR_RAISE
        else:
            message = _("You have specified that the group '%s' should be "
                        "installed.  This group does not exist.  Would you "
                        "like to skip this group and continue with "
                        "installation?") % group
            if self.ui.showYesNoQuestion(message):
                return ERROR_CONTINUE
            else:
                return ERROR_RAISE

    def _noSuchPackageHandler(self, *args, **kwargs):
        package = args[0]
        anaconda_required = kwargs.pop("anaconda_required", False)
        if anaconda_required:
            message = _("Install requires the package '%s' but this package "
                        "does not exist.  This is a fatal error and "
                        "installation will be aborted.") % package
            self.ui.showError(message):
            return ERROR_RAISE
        else:
            message = _("You have specified that the package '%s' should be "
                        "installed.  This package does not exist.  Would you "
                        "like to skip this package and continue with "
                        "installation?") % package
            if self.ui.showYesNoQuestion(message):
                return ERROR_CONTINUE
            else:
                return ERROR_RAISE


2. Wrap calls in the selectRequiredPackages method in pyanaconda/yumpayload.py to try/except NoSuchPackage/Group errors:

    def selectRequiredPackages(self):
        if self._requiredPackages:
            try:
                map(self._selectYumPackage, self._requiredPackages)
            except NoSuchPackage as e:
                self._handleMissing(e, anaconda_required=True)

        if self._requiredGroups:
            try:
                map(self._selectYumGroup, self._requiredGroups)
            except NoSuchGroup as e:
                self._handleMissing(e, anaconda_required=True)
                

3. Modify the _handleMissing method in pyanaconda/yumpayload.py to accept
kwargs and pass along to errorHandler.cb:

    def _handleMissing(self, exn, **kwargs):
        if self.data.packages.handleMissing == KS_MISSING_IGNORE:
            return

        if errorHandler.cb(exn, str(exn), **kwargs) == ERROR_RAISE:
            ...

Comment 2 David Cantrell 2014-02-12 21:10:13 UTC
The proper place for this request is the upstream development area, which is Fedora rawhide.  Moving the bug.

Comment 3 Kay Williams 2014-04-04 21:54:11 UTC
Excellent. Thanks for posting.


Note You need to log in before you can comment on or make changes to this bug.