################################################################################
class Keyring(object):
- gpg_invocation = "gpg --no-default-keyring --keyring %s" +\
- " --with-colons --fingerprint --fingerprint"
-
keys = {}
fpr_lookup = {}
if not self.keyring_id:
raise Exception('Must be initialized with database information')
- k = os.popen(self.gpg_invocation % keyring, "r")
+ cmd = ["gpg", "--no-default-keyring", "--keyring", keyring,
+ "--with-colons", "--fingerprint", "--fingerprint"]
+ p = daklib.daksubprocess.Popen(cmd, stdout=subprocess.PIPE)
+
key = None
need_fingerprint = False
- for line in k:
+ for line in p.stdout:
field = line.split(":")
if field[0] == "pub":
key = field[4]
self.fpr_lookup[field[9]] = key
need_fingerprint = False
+ r = p.wait()
+ if r != 0:
+ raise subprocess.CalledProcessError(r, cmd)
+
def import_users_from_ldap(self, session):
import ldap
cnf = Config()