Re: Tips to add optional arguments on dnf using plugin

2019-07-23 Thread Marek Blaha
Hi Fellipe, if layer in your case means a particular set of repositories, then Nicolas advice with using distinct prefixes for repositories in each layer and then passing --repoid=-* to the dnf is probably most straightforward solution. If you really need a custom plugin, then there is a problem

Re: Tips to add optional arguments on dnf using plugin

2019-07-23 Thread Nicolas Mailhot via devel
Le 2019-07-23 14:09, Stephen John Smoogen a écrit : On Tue, 23 Jul 2019 at 08:00, Nicolas Mailhot via devel wrote: Le 2019-07-23 12:01, Fellipe Henrique a écrit : Hi First, Thanks very much for you reply... I need to add a "global" argument so I can change the layer of a repository... For

Re: Tips to add optional arguments on dnf using plugin

2019-07-23 Thread Fellipe Henrique
Hi Marek, Thanks again for your reply.. I already tried to use __init__ method... arguments was added without error ( I can get any message when add on optparser), but, dnf still say: unrecognized arguments I believe it's because plugin is loaded after args was passed inside dnf, so, dnf not r

Re: Tips to add optional arguments on dnf using plugin

2019-07-23 Thread Stephen John Smoogen
On Tue, 23 Jul 2019 at 08:00, Nicolas Mailhot via devel < devel@lists.fedoraproject.org> wrote: > Le 2019-07-23 12:01, Fellipe Henrique a écrit : > > Hi > > > First, Thanks very much for you reply... > > > > I need to add a "global" argument so I can change the layer of a > > repository... For exa

Re: Tips to add optional arguments on dnf using plugin

2019-07-23 Thread Fellipe Henrique
Thinking here about these... If I made a fork from dnf package, and put arguments inside OptionParser class, on option_parser.py... I get the "global" argument as I needed... but how can I get these argument value inside my plugin? Any idea? cheers T.·.F.·.A.·. S+F *Fellipe Henrique P. Soa

Re: Tips to add optional arguments on dnf using plugin

2019-07-23 Thread Marek Blaha
Hi, there is no supported way how to change global arguments in DNF. However, you can try in __init__ method of your plugin do something like this: class MyPlugin(dnf.Plugin): def __init__(self, base, cli): super(MyPlugin, self).__init__(base, cli) cli.optparser.add_argument('

Re: Tips to add optional arguments on dnf using plugin

2019-07-23 Thread Fellipe Henrique
So, Using dnf plugin, I can't do that, if I understand correctly... As I said on my last email, I have these coded using yum, like these: def init_hook(pc): '''Initial Hook that configures the repositories''' parser = pc.getOptParser() if parser: parser.add_option('', '--set-repos

Re: Tips to add optional arguments on dnf using plugin

2019-07-23 Thread Nicolas Mailhot via devel
Le 2019-07-23 12:01, Fellipe Henrique a écrit : Hi First, Thanks very much for you reply... I need to add a "global" argument so I can change the layer of a repository... For example: $ dnf repolist --set-layer=mylayer $ dnf install -y any_repo --set-layer=mylayer On our setup we approximat

Re: Tips to add optional arguments on dnf using plugin

2019-07-23 Thread Fellipe Henrique
Hi Marek, First, Thanks very much for you reply... I need to add a "global" argument so I can change the layer of a repository... For example: $ dnf repolist --set-layer=mylayer $ dnf install -y any_repo --set-layer=mylayer So on my plug-in I can change layer in repository to do anything, for t

Re: Tips to add optional arguments on dnf using plugin

2019-07-22 Thread Marek Blaha
Each DNF command could have static method set_argparser (here is the example from reposync plugin: https://github.com/rpm-software-management/dnf-plugins-core/blob/master/plugins/reposync.py#L60) which can be used for adding command specific arguments. However there is no such method for adding glo

Tips to add optional arguments on dnf using plugin

2019-07-22 Thread Fellipe Henrique
Hello, First of all, thanks for accept me on these mail list.. my first mail it's about a issue I facing here on my job... I need to add some optional arguments on dnf, not a command, just a "global" args.. eg: $ dnf repolist --my_arg=abcd How can I do these? Can I use plugin with these approa