Last active
June 16, 2018 01:18
-
-
Save ThinGuy/0ea097213a0f4de28244930bdf7c2e44 to your computer and use it in GitHub Desktop.
Fix missing GPG key/fix NO PUBKEY errors while juju is deploying
This file contains 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
juju-fix-missing-gpg-keys() { | |
#search juju debug log for missing GPG keys and apply them to all servers in the model | |
local -a MISSING_KEYS=($((juju debug-log --no-tail --replay|awk '/GPG error/{print $NF}')|sort -u)) | |
local -a MACHINES=($(juju machines|awk '/^[0-9]+/&&/started/{print $1}')) | |
for k in ${MISSING_KEYS[@]};do printf "%s $k\n" ${MACHINES[@]};done|\ | |
xargs -n2 -P0 bash -c 'juju 2>/dev/null ssh $0 sudo apt-key 2>/dev/null adv --recv-key --keyserver keyserver.ubuntu.com $1' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment