コード例 #1
0
    def __apply_selections(self, dbo):
        excludedPkgs = kickstart.get_excluded(self.ks, self._get_excluded_packages())

        if kickstart.nocore(self.ks):
            logging.info("skipping core group due to %%packages --nocore; system may not be complete")
        else:
            try:
                dbo.selectGroup('core', excludedPkgs)
                logging.info("selected group: core")
            except dnf.exceptions.MarkingError as e:
                if kickstart.ignore_missing(self.ks):
                    logging.warning("Skipping missing group 'core'")
                else:
                    raise CreatorError("Failed to find group 'core' : %s" %
                                       (e,))

        env = kickstart.get_environment(self.ks)

        excludedGroups = [group.name for group in kickstart.get_excluded_groups(self.ks)]

        if env:
            try:
                dbo.selectEnvironment(env, excludedGroups, excludedPkgs)
                logging.info("selected env: %s", env)
            except dnf.exceptions.MarkingError as e:
                if kickstart.ignore_missing(self.ks):
                    logging.warning("Skipping missing environment '%s'" % (env,))
                else:
                    raise CreatorError("Failed to find environment '%s' : %s" %
                                       (env, e))

        for group in kickstart.get_groups(self.ks):
            if group.name == 'core' or group.name in excludedGroups:
                continue

            try:
                dbo.selectGroup(group.name, excludedPkgs, group.include)
                logging.info("selected group: %s", group.name)
            except dnf.exceptions.MarkingError as e:
                if kickstart.ignore_missing(self.ks):
                    logging.warning("Skipping missing group '%s'" % (group.name,))
                else:
                    raise CreatorError("Failed to find group '%s' : %s" %
                                       (group.name, e))

        for pkg_name in set(excludedPkgs):
            dbo.deselectPackage(pkg_name)
            logging.info("excluding package: '%s'", pkg_name)

        for pkg_name in set(kickstart.get_packages(self.ks,
                                                   self._get_required_packages())) - set(excludedPkgs):
            try:
                dbo.selectPackage(pkg_name)
                logging.info("selected package: '%s'", pkg_name)
            except dnf.exceptions.MarkingError as e:
                if kickstart.ignore_missing(self.ks):
                    logging.warning("Skipping missing package '%s'" % (pkg_name,))
                else:
                    raise CreatorError("Failed to find package '%s' : %s" %
                                       (pkg_name, e))
コード例 #2
0
    def __sanity_check(self):
        """Ensure that the config we've been given is sane."""
        if not (kickstart.get_packages(self.ks) or
                kickstart.get_groups(self.ks)):
            raise CreatorError("No packages or groups specified")

        kickstart.convert_method_to_repo(self.ks)

        if not kickstart.get_repos(self.ks):
            raise CreatorError("No repositories specified")
コード例 #3
0
 def __select_groups(self, ayum):
     skipped_groups = []
     for group in kickstart.get_groups(self.ks):
         try:
             ayum.selectGroup(group.name, group.include)
         except (yum.Errors.InstallError, yum.Errors.GroupsError), e:
             if kickstart.ignore_missing(self.ks):
                 raise CreatorError("Failed to find group '%s' : %s" %
                                    (group.name, e))
             else:
                 skipped_groups.append(group)