diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-01-24 09:17:40 -0500 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-01-24 09:17:40 -0500 |
commit | 987fd6364887184bf201a0a68f6903cec6cc5d84 (patch) | |
tree | fd666391d5408e3d294ad2f5583fdebd8f530106 /src/sbin/bcfg2-info | |
parent | 4367811c2811d0305cd2be8a1bb7b44fff7a1329 (diff) | |
download | bcfg2-987fd6364887184bf201a0a68f6903cec6cc5d84.tar.gz bcfg2-987fd6364887184bf201a0a68f6903cec6cc5d84.tar.bz2 bcfg2-987fd6364887184bf201a0a68f6903cec6cc5d84.zip |
improved Packages debug info, added packageresolve and packagesources bcfg2-info commands
Diffstat (limited to 'src/sbin/bcfg2-info')
-rwxr-xr-x | src/sbin/bcfg2-info | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/src/sbin/bcfg2-info b/src/sbin/bcfg2-info index 31b9ba0c6..808761d7e 100755 --- a/src/sbin/bcfg2-info +++ b/src/sbin/bcfg2-info @@ -45,6 +45,8 @@ event_debug - Display filesystem events as they are processed groups - List groups help - Print this list of available commands mappings <type*> <name*> - Print generator mappings for optional type and name +packageresolve <hostname> <package> [<package>...] - Resolve the specified set of packages +packagesources - Show package sources profile <command> <args> - Profile a single bcfg2-info command quit - Exit the bcfg2-info command line showentries <hostname> <type> - Show abstract configuration entries for a given host @@ -454,7 +456,7 @@ class infoCore(cmd.Cmd, Bcfg2.Server.Core.Core): try: meta = self.build_metadata(args) except Bcfg2.Server.Plugins.Metadata.MetadataConsistencyError: - print("Unable to find metadata for host %s" % client) + print("Unable to find metadata for host %s" % args) return structures = self.GetStructures(meta) for clist in [struct.findall('Path') for struct in structures]: @@ -473,6 +475,54 @@ class infoCore(cmd.Cmd, Bcfg2.Server.Core.Core): continue print(cand[0].name) + def do_packageresolve(self, args): + arglist = args.split(" ") + if len(arglist) < 2: + print("Usage: packageresolve <hostname> <package> [<package>...]") + return + + 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)) + + def do_packagesources(self, args): + try: + metadata = self.build_metadata(args) + except Bcfg2.Server.Plugins.Metadata.MetadataConsistencyError: + print("Unable to build metadata for host %s" % args) + return + collection = self.plugins['Packages']._get_collection(metadata) + for source in collection.sources: + # get_urls() loads url_map as a side-effect + source.get_urls() + for url_map in source.url_map: + if url_map['arch'] in metadata.groups: + reponame = source.get_repo_name(url_map) + print("Name: %s" % reponame) + print(" Type: %s" % source.ptype) + print(" URL: %s" % url_map['url']) + if source.gpgkeys: + print(" GPG Key(s): %s" % ", ".join(source.gpgkeys)) + else: + print(" GPG Key(s): None") + if len(source.blacklist): + print(" Blacklist: %s" % ", ".join(source.blacklist)) + if len(source.whitelist): + print(" Whitelist: %s" % ", ".join(source.whitelist)) + print("") + def do_profile(self, arg): """.""" if not have_profile: |