Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 935743 Details for
Bug 1139730
install function behave differently when used in dnf plugin code
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
sample dnf plugin code where install() perform installation of packages also.
myinstall.py (text/plain), 1.89 KB, created by
Parag Nemade
on 2014-09-09 14:01:07 UTC
(
hide
)
Description:
sample dnf plugin code where install() perform installation of packages also.
Filename:
MIME Type:
Creator:
Parag Nemade
Created:
2014-09-09 14:01:07 UTC
Size:
1.89 KB
patch
obsolete
># -*- coding: utf-8 -*- ># Copyright © 2014 Red Hat, Inc. ># ># Authors: Parag Nemade <pnemade@redhat.com> ># ># This program is free software; you can redistribute it and/or modify ># it under the terms of the GNU General Public License as published by ># the Free Software Foundation; either version 2 of the License, or ># (at your option) any later version. ># ># This program is distributed in the hope that it will be useful, ># but WITHOUT ANY WARRANTY; without even the implied warranty of ># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ># GNU General Public License for more details. > >from dnfpluginscore import _, logger > >import dnf >import dnf.cli >import dnf.yum.misc > >class MyinstallCommand(dnf.cli.Command): > """ myinstall plugin for DNF """ > > aliases = ("myinstall",) > summary = _('Install the given packages') > usage = "[PKG1...]" > > def configure(self, args): > demands = self.cli.demands > demands.resolving = True > demands.root_user = True > demands.sack_activation = True > > def run(self, args): > self.base.fill_sack() > self.base.repos.iter_enabled() > qry = self.base.sack.query() > qry = qry.available() > qry = qry.latest() > > for pkg in args: > try: > qry1 = qry.filter(provides=pkg) > if qry1: > self.base.install(pkg) > except dnf.exceptions.MarkingError: > msg = _("No matching package to install: '%s'") % pkg > raise dnf.exceptions.Error(msg) > return > >class MyPlugins(dnf.Plugin): > """DNF plugin supplying the 'myinstall' command.""" > > name = 'myinstall' > def __init__(self, base, cli): > """Initialize the plugin instance.""" > super(MyPlugins, self).__init__(base, cli) > if cli is not None: > cli.register_command(MyinstallCommand) > logger.debug("initialized myinstall plugin") >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1139730
: 935743 |
936072