Last active
June 14, 2021 02:42
-
-
Save ToroNZ/24f73619eb08311607ba27428d0f04b0 to your computer and use it in GitHub Desktop.
Katello-content-host-report-HTML
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Get list of hosts and outstanding errata from Satellite | |
hammer --csv content-hosts --export --columns "Name,OS,Security Errata,Bug Fix Errata,Enhancement Errata" --file /var/www/html/pub/errata.all.csv.txt | |
# Now create an html file from the CSV file | |
html_file=/var/www/html/pub/errata.html | |
( echo "<html> | |
<head><title>Contents Hosts Outstanding Errata</title> | |
</head> | |
<body> | |
<h1>Contents Hosts Outstanding Errata</h1> | |
<table border=1 cellpadding=4 rules=all> | |
<TR> | |
<TH>Host</TH> | |
<TH>Operating System</TH> | |
<TH>Security Errata</TH> | |
<TH>Bug Fix Errata</TH> | |
<TH>Enhancement Errata</TH> | |
</TR>" | |
awk -F',' '$1!="Name"{print "<TR><TD><A HREF=https://my_satellite_server/content_hosts/"$1">",$1,"</TD><TD>",$2,"</TD><TD>",$3,"</TD><TD>",$4,"</TD><TD>",$5,"</TD></TR>"}' /var/www/html/pub/errata.csv.txt | |
echo "</table> | |
<p>This page generated `date` | |
<br>by `hostname -s`:$0 | |
<br>by user `id` | |
</body> | |
</html>" ) > $html_file | |
# Allow world to see the data | |
chmod 644 /var/www/html/pub/errata.* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment