Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using security.py non-interactively #2

Open
svenXY opened this issue Feb 22, 2016 · 0 comments
Open

using security.py non-interactively #2

svenXY opened this issue Feb 22, 2016 · 0 comments

Comments

@svenXY
Copy link

svenXY commented Feb 22, 2016

Hi,

I'm trying to use the security module non-interactively, something along the lines of

import os, sys, yum
from optparse import OptionParser

yb = yum.YumBase()

yb.preconf.disableplugin = []
yb.preconf.plugin_types = (yum.plugins.TYPE_CORE,
                                           yum.plugins.TYPE_INTERACTIVE
                                          )
opt_prsr = OptionParser()
yb.preconf.optparser = opt_prsr
yb.conf.cache = os.geteuid() != 0
opts, args = opt_prsr.parse_args([])
# The yum security plugin will crap pants if the plugin
# cmdline isn't set up:
yb.plugins.setCmdLine(opts, args)

pl = yb.doPackageLists('updates', patterns=sys.argv[1:])

this fails with

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 911, in <lambda>
    conf = property(fget=lambda self: self._getConfig(),
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 335, in _getConfig
    startupconf.pluginconfpath,disabled_plugins,enabled_plugins)
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 564, in doPluginSetup
    plugin_types, confpath, disabled_plugins, enabled_plugins)
  File "/usr/lib/python2.6/site-packages/yum/plugins.py", line 167, in __init__
    self.run('config')
  File "/usr/lib/python2.6/site-packages/yum/plugins.py", line 184, in run
    func(conduitcls(self, self.base, conf, **kwargs))
  File "/usr/lib/yum-plugins/security.py", line 615, in config_hook
    conduit.registerCommand(UpdateinfoCommand())
  File "/usr/lib/python2.6/site-packages/yum/plugins.py", line 508, in registerCommand
    raise Errors.ConfigError(_('registration of commands not supported'))
yum.Errors.ConfigError: registration of commands not supported

I'd like to have the lists WITH the information taken from security (i.e. as if I had used --security).

Is it possible?
I know some python, but I am not overly proficient.

Thanks for any insight you might be able to provide,
Sven

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant