Useful scripts

Having been back at Red Hat for about a year and a half now, I’m starting to get back into a mode of ‘fix that which hasn’t yet been fixed by others’. Which, as a consultant, really means ‘make stuff work for clients’. Since most (read: 90% plus) of my deployments have been Satellite-based, I’ve been getting a lot of questions along the lines of “Can I get a report on ${foo} from the Satellite?”

Well, most of the reports that clients are used to, in my experience at least, are no longer available or are very difficult to get in Satellite 6. While not required for operational reasons, those reports often are required for reporting or auditing reasons. Some of the reasons advanced by clients seem specious (at best), but I try not to judge, I simply give them what they ask for, while telling them about better ways to get the results they’re looking for, though perhaps not the data arranged the way they think they want it.

One of my clients wanted to be able to look at a report of hosts/hostgroups that needed updates, and the types of updates (security, bugfix, enhancement), so I decided this was as good a time as any to start scripting some useful things. I don’t know if these things are available elsewhere, and I’m reasonably certain there are better ways to get to the data that I wanted but I’ve now gotten to the point where I have my first “report” available. I’ve tested it against my homelab environment, and it seem to work exactly the way I want it to.

This report is in the form of an OpenOffice / LibreOffice workbook (.ods format), and details the hosts in the Satellite that have applicable errata outstanding and how many errata are outstanding. It then creates a new sheet for each host, which lists all of the errata available for that host, the type of erratum (security, bugfix, enhancement), and how many packages are affected by that erratum. Then it creates individual sheets for each erratum outstanding across the entire environment, and lists the erratum ID, the name, the type, and the actual packages it affects / updates.

If you want to take a look at it, head over to GitHub (https://github.com/jwbernin/sat-tools) and grab the sources, create an appropriate credentials.json file, then run the errataByHost.py script. If you find it useful, let me know – if you’d like to see something added to it, or if you’d like to see another report, also let me know and I’ll do what I can.

Comments are closed.