From 9bf76f4b581c37b03bac49636447325146531dc9 Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Wed, 21 Oct 2009 02:55:12 +0000 Subject: bcfg2-info: simplify codepaths for debug mode git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5489 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Client/Tools/YUMng.py | 7 +++---- src/lib/Server/Plugins/Packages.py | 4 ++++ src/sbin/bcfg2-info | 34 +--------------------------------- 3 files changed, 8 insertions(+), 37 deletions(-) diff --git a/src/lib/Client/Tools/YUMng.py b/src/lib/Client/Tools/YUMng.py index 4c295de62..35852dd7f 100644 --- a/src/lib/Client/Tools/YUMng.py +++ b/src/lib/Client/Tools/YUMng.py @@ -78,10 +78,9 @@ class YUMng(Bcfg2.Client.Tools.RPMng.RPMng): self.yb = yum.YumBase() if hasattr(self.yb, 'doGenericSetup'): self.yb.doGenericSetup() - else: - self.yb.doConfigSetup() - self.yb.doTsSetup() - self.yb.doRpmDBSetup() + self.yb.doConfigSetup() + self.yb.doTsSetup() + self.yb.doRpmDBSetup() yup = self.yb.doPackageLists(pkgnarrow='updates') if hasattr(self.yb.rpmdb, 'pkglist'): yinst = self.yb.rpmdb.pkglist diff --git a/src/lib/Server/Plugins/Packages.py b/src/lib/Server/Plugins/Packages.py index 47d97957e..02596c5a8 100644 --- a/src/lib/Server/Plugins/Packages.py +++ b/src/lib/Server/Plugins/Packages.py @@ -158,6 +158,10 @@ class Source(object): except NoData: item_is_virt = False + #print "%s:%s:%s" % (item, item_is_pkg, item_is_virt) + if (not item_is_pkg) and (not item_is_virt): + unknown.add(item) + continue if item_is_pkg and not item_is_virt: newpkg.add(item) try: diff --git a/src/sbin/bcfg2-info b/src/sbin/bcfg2-info index 93f417d89..2dad05fd4 100755 --- a/src/sbin/bcfg2-info +++ b/src/sbin/bcfg2-info @@ -24,38 +24,6 @@ logger = logging.getLogger('bcfg2-info') class dummyError(Exception): pass -class debug_fcacher: - "Cache the stdout text so we can analyze it before returning it" - def __init__(self): self.reset() - def reset(self): self.out = [] - def write(self, line): self.out.append(line) - def flush(self): - output = '\n'.join(self.out) - self.reset() - return output - -class debug_shell(InteractiveConsole): - "Wrapper around Python that can filter input/output to the shell" - def __init__(self, mylocals): - self.stdout = sys.stdout - self.cache = debug_fcacher() - InteractiveConsole.__init__(self, mylocals) - - def get_output(self): sys.stdout = self.cache - def return_output(self): sys.stdout = self.stdout - - def push(self, line): - self.get_output() - # you can filter input here by doing something like - # line = filter(line) - rc = InteractiveConsole.push(self, line) - self.return_output() - output = self.cache.flush() - # you can filter the output here by doing something like - # output = filter(output) - sys.stdout.write(output) - return rc - class ConfigFileNotBuilt(Exception): ''' Thrown when ConfigFile entry contains no content''' def __init__(self, value): @@ -139,7 +107,7 @@ class infoCore(cmd.Cmd, Bcfg2.Server.Core.Core): def do_debug(self, _): self.cont = False print("dropping to python interpreter; press ^D to resume") - sh = debug_shell(locals()) + sh = InteractiveConsole(locals()) sh.interact() def do_quit(self, _): -- cgit v1.2.3-1-g7c22