Import apt-key keys only if they don't exist
Change-Id: I66124a7fa04d3ced08cde5403c2f9b5d0874903c
diff --git a/linux/system/repo.sls b/linux/system/repo.sls
index 73bb33d..d8794d8 100644
--- a/linux/system/repo.sls
+++ b/linux/system/repo.sls
@@ -85,6 +85,7 @@
{% set repo_key = salt['hashutil.base64_b64encode'](repo.key) %}
cmd.run:
- name: "echo '{{ repo_key }}' | base64 -d | apt-key add -"
+ - unless: "apt-key finger | grep -q \"$(echo '{{ repo_key }}' | base64 -d | gpg --with-fingerprint -o - | grep -wi 'fingerprint')\""
- require_in:
{%- if repo.get('default', False) %}
- file: default_repo_list