Skip to content

Commit fe5861b

Browse files
author
Slavek Kabrda
authored
Fix condition for adding gpg key to work with all gpg versions (#701)
1 parent 6c34e03 commit fe5861b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

manifests/ubuntu.pp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@
5555

5656
exec { "ensure key ${key_fingerprint} is imported in APT keyring":
5757
command => "/bin/cat /tmp/${key_fingerprint} | gpg --import --batch --no-default-keyring --keyring ${apt_usr_share_keyring}",
58-
unless => "/bin/cat /tmp/${key_fingerprint} | gpg --dry-run --import --batch --no-default-keyring --keyring ${apt_usr_share_keyring} 2>&1 | grep 'unchanged: 1'",
58+
# the second part extracts the fingerprint of the key from output like "fpr::::A2923DFF56EDA6E76E55E492D3A80E30382E94DE:"
59+
unless => @("CMD"/L)
60+
/usr/bin/gpg --no-default-keyring --keyring ${apt_usr_share_keyring} --list-keys --with-fingerprint --with-colons | grep \
61+
$(cat /tmp/${key_fingerprint} | gpg --with-colons --with-fingerprint 2>/dev/null | grep 'fpr:' | sed 's|^fpr||' | tr -d ':')
62+
| CMD
5963
}
6064
}
6165

0 commit comments

Comments
 (0)