diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2008-07-14 19:05:27 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2008-07-14 19:05:27 +0000 |
commit | 9949402e118fc3535c29819b48aa2686797809b2 (patch) | |
tree | eb242533f16a57842a90b19640d4307feb0ec33d /src/sbin | |
parent | c10f4de0b0f71dd8e0cf794ece1773e0e6c08eec (diff) | |
download | bcfg2-9949402e118fc3535c29819b48aa2686797809b2.tar.gz bcfg2-9949402e118fc3535c29819b48aa2686797809b2.tar.bz2 bcfg2-9949402e118fc3535c29819b48aa2686797809b2.zip |
bcfg2-info: add cfgdebug function
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4782 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/sbin')
-rwxr-xr-x | src/sbin/bcfg2-info | 22 |
1 files changed, 22 insertions, 0 deletions
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 = { |