+ def refresh_keyring(self, fingerprint=None):
+ if fingerprint is not None:
+ print('Refreshing local keyring... Missing key: ' + fingerprint)
+ else:
+ print('Refreshing local keyring...')
+
+ p = subprocess.Popen(['/usr/bin/gpg2', '--status-fd', '2',
+ '--homedir', self.paths['gnupg_homedir'],
+ '--keyserver', 'hkps://keys.openpgp.org',
+ '--refresh-keys'], stderr=subprocess.PIPE)
+ p.wait()
+
+ for output in p.stderr.readlines():
+ match = gnupg_import_ok_pattern.match(output)
+ if match and match.group(2) == 'IMPORT_OK':
+ fingerprint = str(match.group(4))
+ if match.group(3) == '0':
+ print('Keyring refreshed successfully...')
+ print(' No key updates for key: ' + fingerprint)
+ elif match.group(3) == '4':
+ print('Keyring refreshed successfully...')
+ print(' New signatures for key: ' + fingerprint)
+ else:
+ print('Keyring refreshed successfully...')
+