diff options
Diffstat (limited to 'src/sbin/bcfg2-info')
-rwxr-xr-x | src/sbin/bcfg2-info | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/src/sbin/bcfg2-info b/src/sbin/bcfg2-info index 287d0a161..ad35bbeeb 100755 --- a/src/sbin/bcfg2-info +++ b/src/sbin/bcfg2-info @@ -473,7 +473,7 @@ Bcfg2 client itself.""") ('Password', self.setup['password']), ('Server Metadata Connector', self.setup['mconnect']), ('Filemonitor', self.setup['filemonitor']), - ('Server address', self.setup['location']), + ('Server address', self.setup['location']), ('Path to key', self.setup['key']), ('Path to SSL certificate', self.setup['cert']), ('Path to SSL CA certificate', self.setup['ca']), @@ -640,21 +640,24 @@ Bcfg2 client itself.""") if 'Packages' not in self.plugins: print("Packages plugin not enabled") return + self.plugins['Packages'].toggle_debug() + + indep = lxml.etree.Element("Independent") + structures = [lxml.etree.Element("Bundle", name="packages")] + for arg in arglist[1:]: + lxml.etree.SubElement(structures[0], "Package", name=arg) + hostname = arglist[0] - initial = arglist[1:] metadata = self.build_metadata(hostname) - self.plugins['Packages'].toggle_debug() - collection = self.plugins['Packages'].get_collection(metadata) - packages, unknown = collection.complete(initial) - newpkgs = list(packages.difference(initial)) - print("%d initial packages" % len(initial)) - print(" %s" % "\n ".join(initial)) - print("%d new packages added" % len(newpkgs)) - if newpkgs: - print(" %s" % "\n ".join(newpkgs)) - print("%d unknown packages" % len(unknown)) - if unknown: - print(" %s" % "\n ".join(unknown)) + + # pylint: disable=W0212 + self.plugins['Packages']._build_packages(metadata, indep, structures) + # pylint: enable=W0212 + + print("%d new packages added" % len(indep.getchildren())) + if len(indep.getchildren()): + print(" %s" % "\n ".join(lxml.etree.tostring(p) + for p in indep.getchildren())) def do_packagesources(self, args): """ packagesources <hostname> - Show package sources """ @@ -726,17 +729,19 @@ Bcfg2 client itself.""") pass - def build_usage(): """ build usage message """ cmd_blacklist = ["do_loop", "do_EOF"] usage = dict() for attrname in dir(InfoCore): attr = getattr(InfoCore, attrname) - if (hasattr(attr, "__func__") and - attr.__func__.func_name not in cmd_blacklist and - attr.__func__.func_name.startswith("do_") and - attr.__func__.func_doc): + + # shim for python 2.4, __func__ is im_func + funcattr = getattr(attr, "__func__", getattr(attr, "im_func", None)) + if (funcattr != None and + funcattr.func_name not in cmd_blacklist and + funcattr.func_name.startswith("do_") and + funcattr.func_doc): usage[attr.__name__] = re.sub(r'\s+', ' ', attr.__doc__) return "Commands:\n" + "\n".join(usage[k] for k in sorted(usage.keys())) @@ -748,9 +753,8 @@ def main(): optinfo = dict(profile=Bcfg2.Options.CORE_PROFILE, interactive=Bcfg2.Options.INTERACTIVE, interpreter=Bcfg2.Options.INTERPRETER) - optinfo.update(Bcfg2.Options.CLI_COMMON_OPTIONS) - optinfo.update(Bcfg2.Options.SERVER_COMMON_OPTIONS) - setup = Bcfg2.Options.load_option_parser(optinfo) + optinfo.update(Bcfg2.Options.INFO_COMMON_OPTIONS) + setup = Bcfg2.Options.OptionParser(optinfo) setup.hm = "\n".join([" bcfg2-info [options] [command <command args>]", "Options:", setup.buildHelpMessage(), |