Example #1
0
    def configure(self):
        self._canonical()

        cmd = self.opts.subcmd
        args = self.opts.args

        cmds = ('list', 'info', 'remove', 'install', 'upgrade', 'summary', 'mark')
        if cmd not in cmds:
            logger.critical(_('Invalid groups sub-command, use: %s.'),
                            ", ".join(cmds))
            raise dnf.cli.CliError

        demands = self.cli.demands
        demands.sack_activation = True
        if cmd in ('install', 'mark', 'remove', 'upgrade'):
            demands.root_user = True
        if cmd == 'remove':
            demands.allow_erasing = True
            demands.available_repos = False
        else:
            demands.available_repos = True

        commands.checkEnabledRepo(self.base)

        if cmd in ('install', 'remove', 'mark', 'info'):
            if not args:
                self.cli.optparser.print_help(self)
                raise dnf.cli.CliError

        if cmd in ('install', 'upgrade'):
            commands.checkGPGKey(self.base, self.cli)
Example #2
0
 def configure(self):
     demands = self.cli.demands
     demands.sack_activation = True
     demands.available_repos = True
     demands.resolving = True
     demands.root_user = True
     commands.checkGPGKey(self.base, self.cli)
     commands.checkEnabledRepo(self.base, self.opts.packages)
Example #3
0
    def doCheck(self, basecmd, extcmds):
        """Verify that conditions are met so that this command can run.
        These include that the program is being run by the root user,
        and that there are enabled repositories with gpg keys.

        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        """
        commands.checkGPGKey(self.base, self.cli)
        commands.checkEnabledRepo(self.base, extcmds)
Example #4
0
    def doCheck(self, basecmd, extcmds):
        """Verify that conditions are met so that this command can run.
        These include that the program is being run by the root user,
        and that there are enabled repositories with gpg keys.

        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        """
        commands.checkGPGKey(self.base, self.cli)
        commands.checkEnabledRepo(self.base, extcmds)
Example #5
0
File: install.py Project: hanzz/dnf
 def configure(self):
     """Verify that conditions are met so that this command can run.
     That there are enabled repositories with gpg keys, and that
     this command is called with appropriate arguments.
     """
     demands = self.cli.demands
     demands.sack_activation = True
     demands.available_repos = True
     demands.resolving = True
     demands.root_user = True
     commands.checkGPGKey(self.base, self.cli)
     commands.checkEnabledRepo(self.base, self.opts.filenames)
Example #6
0
    def configure(self):
        """Verify that conditions are met so that this command can run.

        These include that there are enabled repositories with gpg
        keys, and that this command is being run by the root user.
        """
        demands = self.cli.demands
        demands.sack_activation = True
        demands.available_repos = True
        demands.resolving = True
        demands.root_user = True
        commands.checkGPGKey(self.base, self.cli)
        commands.checkEnabledRepo(self.base, self.opts.pkg_specs)
Example #7
0
    def doCheck(self, basecmd, extcmds):
        """Verify that conditions are met so that this command can run.
        The exact conditions checked will vary depending on the
        subcommand that is being called.

        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        """
        cmd, extcmds = self._grp_cmd(extcmds)

        commands.checkEnabledRepo(self.base)

        if cmd in ("install", "remove", "mark", "info"):
            _ensure_grp_arg(self.cli, cmd, extcmds)

        if cmd in ("install", "upgrade"):
            commands.checkGPGKey(self.base, self.cli)

        cmds = ("list", "info", "remove", "install", "upgrade", "summary", "mark")
        if cmd not in cmds:
            logger.critical(_("Invalid groups sub-command, use: %s."), ", ".join(cmds))
            raise dnf.cli.CliError
Example #8
0
    def doCheck(self, basecmd, extcmds):
        """Verify that conditions are met so that this command can run.
        The exact conditions checked will vary depending on the
        subcommand that is being called.

        :param basecmd: the name of the command
        :param extcmds: the command line arguments passed to *basecmd*
        """
        cmd, extcmds = self._grp_cmd(extcmds)

        commands.checkEnabledRepo(self.base)

        if cmd in ('install', 'remove', 'mark', 'info'):
            _ensure_grp_arg(self.cli, cmd, extcmds)

        if cmd in ('install', 'upgrade'):
            commands.checkGPGKey(self.base, self.cli)

        cmds = ('list', 'info', 'remove', 'install', 'upgrade', 'summary', 'mark')
        if cmd not in cmds:
            logger.critical(_('Invalid groups sub-command, use: %s.'),
                                 ", ".join(cmds))
            raise dnf.cli.CliError