From 9949402e118fc3535c29819b48aa2686797809b2 Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Mon, 14 Jul 2008 19:05:27 +0000 Subject: bcfg2-info: add cfgdebug function git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4782 ce84e21b-d406-0410-9b95-82705330c041 --- src/sbin/bcfg2-info | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/sbin/bcfg2-info b/src/sbin/bcfg2-info index eb65378d0..df278ed92 100755 --- a/src/sbin/bcfg2-info +++ b/src/sbin/bcfg2-info @@ -265,6 +265,28 @@ Usage: [quit|exit]""" def do_event_debug(self, args): self.fam.debug = True + def do_cfgdebug(self, args): + try: + meta = self.metadata.get_metadata(args) + except Bcfg2.Server.Plugins.Metadata.MetadataConsistencyError: + print "Unable to find metadata for host %s" % client + return + structures = self.GetStructures(meta) + for clist in [struct.findall('ConfigFile') for struct in structures]: + for cfile in clist: + if cfile.get('name') in self.plugins['Cfg'].Entries['ConfigFile']: + cset = self.plugins['Cfg'].entries[cfile.get('name')] + cand = cset.get_matching(meta) + fields = ['all', 'group'] + while len(cand) > 1 and fields: + field = fields.pop(0) + [cand.remove(c) for c in cand[:] + if getattr(c.specific, field)] + if len(cand) != 1: + print >>sys.stderr, "Entry %s failed" % cfile.get('name') + continue + print cand[0].name + if __name__ == '__main__': Bcfg2.Logging.setup_logging('bcfg2-info', to_syslog=False) optinfo = { -- cgit v1.2.3-1-g7c22