git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/os-patching-adhoc49
1 files changed, 31 insertions, 18 deletions
diff --git a/bin/os-patching-adhoc b/bin/os-patching-adhoc
index 5e62bf4..ae0b7d0 100755
--- a/bin/os-patching-adhoc
+++ b/bin/os-patching-adhoc
@@ -250,31 +250,44 @@ case "$ID_LIKE" in
"rhel"*|"centos"*)
# we do not use --skip-broken here - we keep our systems tidy, so any pollution may and should
# cause an error :-)
-
+
+ # On RHEL and derivatives, dnf populates separate caches for each user, requiring us to do something
+ # like "list updates" as well as root (or inefficiently build the cache twice). :-}
+ # This is scripted, so for now this script has to be called as root. We could consider using sudo below
+ # in the future; however this would be a decision for the whole script as for now, we don't do escalations
+ # anywhere.
header 'Starting package list update'
mystart="$(/usr/bin/date '+%s')"
/usr/bin/dnf -d1 makecache && printf 'OK.\n' || exit 110
myend="$(/usr/bin/date '+%s')"
footer "...done ($((myend - mystart)) seconds)."
+ ULIST="$(/usr/bin/dnf -d0 list --upgrades | grep -v '^Available Upgrades')"
+ UPDATENUM="$(printf '%b\n' "$ULIST" | grep -vcP '^$')"
+ printf '\033[3m\033[1m%b update(s) found.\033[0m\n' "$UPDATENUM"
- header 'Starting package upgrade'
- mystart="$(/usr/bin/date '+%s')"
- /usr/bin/dnf --comment='os_patching_adhoc' -d1 --obsoletes --best -y upgrade &&\
- printf 'OK.\n' || exit 111
- myend="$(/usr/bin/date '+%s')"
- footer "...done ($((myend - mystart)) seconds)."
-
- header 'Checking reboot requirement'
- if ! /usr/bin/dnf -d1 needs-restarting -r; then
- footer 'Outdated libraries or kernel found, rebooting.'
- /usr/bin/systemctl reboot
+ # No updates found?
+ if [ "$UPDATENUM" -lt 1 ]; then
+ printf '\033[3m\033[1m\033[2mSkipping updates.\033[0m\n'
else
- if [ -x "$OSPBIN" ]; then
- header 'Starting os_patching_fact_generation.sh'
- ospstart="$(/usr/bin/date '+%s')"
- "$OSPBIN"
- ospend="$(/usr/bin/date '+%s')"
- footer "...done ($((ospend - ospstart)) seconds)."
+ header 'Starting package upgrade'
+ mystart="$(/usr/bin/date '+%s')"
+ /usr/bin/dnf --comment='os_patching_adhoc' -d1 --obsoletes --best -y upgrade &&\
+ printf 'OK.\n' || exit 111
+ myend="$(/usr/bin/date '+%s')"
+ footer "...done ($((myend - mystart)) seconds)."
+
+ header 'Checking reboot requirement'
+ if ! /usr/bin/dnf -d1 needs-restarting -r; then
+ footer 'Outdated libraries or kernel found, rebooting.'
+ /usr/bin/systemctl reboot
+ else
+ if [ -x "$OSPBIN" ]; then
+ header 'Starting os_patching_fact_generation.sh'
+ ospstart="$(/usr/bin/date '+%s')"
+ "$OSPBIN"
+ ospend="$(/usr/bin/date '+%s')"
+ footer "...done ($((ospend - ospstart)) seconds)."
+ fi
fi
fi
;;
class='column3'>| Ensure /etc/gitlab/ssl exists before putting certs in itNick Walker 2015-09-241-0/+4 | | | | * | Update README partiallyNick Walker 2015-09-221-15/+34 | | | | | | | | | | | | | | | | | | | | | I made some updates to the README that I never committed. I'm probably going to change some of this but it's more useful with these additions than without. | * | Correct module namespace for stash moduleNick Walker 2015-09-221-1/+1 | | | | * | Add hiera key for tuning max_requests_per_instanceNick Walker 2015-09-221-0/+3 | | | | | | | | | | | | https://docs.puppetlabs.com/pe/2015.2/config_puppetserver.html#tuning-maxrequestsperinstance-on-puppet-server | * | add modules for stash and a profileNick Walker 2015-08-252-10/+32 | | | | * | Update the repo name for deploy keys and webhook to match READMENick Walker 2015-08-181-2/+2 | | | | * | Update READMENick Walker 2015-08-181-8/+22 | | | | * | Update version of abrader-gmsNick Walker 2015-08-181-1/+1 | | | | * | Update the README with more specific instructionsNick Walker 2015-08-181-0/+26 | | | | | | | | | | | | This is still a WIP | * | Move some hieradata around for easier testing in vagrantNick Walker 2015-08-183-0/+5 | | | | | | | | | | | | | | | | | | | | | | | | I now have a virtual hierarchy level for setting up my lower memory settings when using vagrant/virtualbox. The gms settings are in an example-puppet-master.yaml file in the nodes directory which are needed for the instructions. | * | Copy agent certs into Gitlab directory for Gitlab SSLNick Walker 2015-08-181-0/+13 | | | | * | Change default gitlab url to be https instead of httpNick Walker 2015-08-171-1/+1 | | | | * | Add webhook config to git management systemNick Walker 2015-08-171-2/+11 | | | | * | Add abrader-gms module to PuppetfileNick Walker 2015-08-171-0/+5 | | | | * | Add vhsn/gitlab and acidprime/r10k to PuppetfileNick Walker 2015-08-141-0/+7 | | | | * | Add a gitlab roleNick Walker 2015-08-141-0/+5 | | | | * | Add a gitlab profile / add ssh-keygen to puppetmaster profileNick Walker 2015-08-142-0/+45 | | | | * | Add puppet-master.yaml to hieradataNick Walker 2015-08-141-0/+42 | | | | | | | | | | | | | | | I need a way to tune my VMs to use less memory and this allows me to do that. | * | Remove extraneous slash from puppetmaster profileNick Walker 2015-08-141-1/+1 | | | | * | Fix some incorrect quoting in the hiera classNick Walker 2015-08-131-3/+3 | | | | | | | | | | | | | | | | | | | | | I thought I needed to double quote items that had interpolated variables but it turns out I don't need to which is good because I effectively can't due to .to_yaml not doing what I wanted it to do. | * | Fix some quoting issues and add role:: to the include in site.ppNick Walker 2015-08-132-4/+4 | | | | * | Add execute bit to config_version scriptsNick Walker 2015-08-132-0/+0 | | | | * | Update the README, add an all_in_one_pe roleNick Walker 2015-08-133-28/+60 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Updating README for instructions on how to use the control-repo by putting it in your own git server and then using the r10k answers during installation of PE. Removing the manifest for configuring r10k using zack/r10k. Added a role that can be used to bootstrap an all-in-one PE installation. | * | fix config_version script for 3.8 and belowNick Walker 2015-08-031-1/+1 | | | | * | Update site.pp to use a trusted fact roleNick Walker 2015-08-031-0/+5 | | | | | | | | | | | | | | | | | | Allow including a role if defined via a trusted fact on the node during provisioning time. This is how I will bootstrap any necessary configuration on the master, or other PE internal nodes. | * | Update config_version to use a script that does not require gitNick Walker 2015-08-033-1/+25 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The config_version now uses a script that will do one of two things: 1. call config_version.rb which uses rugged to find the information about the latest commit if PE is on version 2015.2 or newer 2. make a call to git if the PE version is less than 2015.2 | * | Remove hiera.yaml and instead manage it with puppet codeNick Walker 2015-08-033-9/+19 | | | | | | | | | | | | | | | Added hunner/hiera to the Puppetfile and a manifest to use it instead of placing a hiera.yaml in the repo. | * | Update environment.confNick Walker 2015-06-261-1/+1 | | | | * | Update PuppetfileNick Walker 2015-06-261-0/+4 | | | | * | Remove purgedirsNick Walker 2015-06-251-1/+0 | | | | * | Add a site directory with example role and profile moduleNick Walker 2015-05-273-0/+19 | | | | * | add site to modulepath in environment.confNick Walker 2015-05-271-1/+1 | | | | * | Update README.mdNick Walker 2015-05-261-0/+6 | | | | * | Update README.mdNick Walker 2015-05-151-1/+1 | | | | * | Update PuppetfileNick Walker 2015-05-151-2/+7 | | | | * | Rename defaults.yaml to common.yamlNick Walker 2015-05-151-0/+0 | | | | * | Update hiera.yamlNick Walker 2015-05-151-5/+1 | | | | * | Update configure_r10k.pp for PE3.8Nick Walker 2015-05-151-4/+3 | | | | * | Update hiera.yamlNick Walker 2015-05-141-2/+1 | | | | * | Update site.pp to work OOTBNick Walker 2015-05-111-1/+1 | | | | * | Update README.md