Пример #1
0
yb.preconf.errorlevel = 0
yb.optparser = yb.getOptionParser()
if hasattr(yb, 'getOptionGroup'): # check if the group option API is available
    group = yb.getOptionGroup()
else:
    group = yb.optparser
group.add_option("--save", default=False, action="store_true",
          help='save the current options (useful with --setopt)')
group.add_option("--enable", default=False, action="store_true",
          help='enable the specified repos (automatically saves)')
group.add_option("--disable", default=False, action="store_true",
          help='disable the specified repos (automatically saves)')
group.add_option("--add-repo", default=[], dest='addrepo', action='append',
          help='add (and enable) the repo from the specified file or url')
try:
    opts = yb.doUtilConfigSetup()
except yum.Errors.RepoError, e:
    logger.error(str(e))
    sys.exit(50)

if opts.save or opts.enable or opts.disable or opts.addrepo:
    if yb.conf.uid != 0:
        logger.error("You must be root to change the yum configuration.")
        sys.exit(50)
        
args = set(yb.cmds)

if opts.enable and opts.disable:
    logger.error("Error: Trying to enable and disable repos.")
    opts.enable = opts.disable = False
if opts.enable and not args:
Пример #2
0
 def doUtilConfigSetup(self, *args, **kwargs):
     """ We override this to get our extra option out. """
     opts = YumUtilBase.doUtilConfigSetup(self, *args, **kwargs)
     self.no_debuginfo_plugin = opts.no_debuginfo_plugin
     return opts
Пример #3
0
yb.preconf.errorlevel = 0
yb.optparser = yb.getOptionParser()
if hasattr(yb, 'getOptionGroup'): # check if the group option API is available
    group = yb.getOptionGroup()
else:
    group = yb.optparser
group.add_option("--save", default=False, action="store_true",
          help='save the current options (useful with --setopt)')
group.add_option("--enable", default=False, action="store_true",
          help='enable the specified repos (automatically saves)')
group.add_option("--disable", default=False, action="store_true",
          help='disable the specified repos (automatically saves)')
group.add_option("--add-repo", default=[], dest='addrepo', action='append',
          help='add (and enable) the repo from the specified file or url')
try:
    opts = yb.doUtilConfigSetup()
    yb.repos
except yum.Errors.YumBaseError, e:
    logger.error(str(e))
    sys.exit(50)

if opts.save or opts.enable or opts.disable or opts.addrepo:
    if yb.conf.uid != 0:
        logger.error("You must be root to change the yum configuration.")
        sys.exit(50)
        
args = set(yb.cmds)

if opts.enable and opts.disable:
    logger.error("Error: Trying to enable and disable repos.")
    opts.enable = opts.disable = False
Пример #4
0
 def doUtilConfigSetup(self, *args, **kwargs):
     """ We override this to get our extra option out. """
     opts = YumUtilBase.doUtilConfigSetup(self, *args, **kwargs)
     self.no_debuginfo_plugin = opts.no_debuginfo_plugin
     return opts