From: Brian Dolbec Date: Sun, 23 Jun 2013 01:26:52 +0000 (-0700) Subject: Strip line feeds from seeds when loading X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6f9daea91be0a41bf42ce1da065fa7e2d5782235;p=gentoo-keys.git Strip line feeds from seeds when loading --- diff --git a/gkeyldap/cli.py b/gkeyldap/cli.py index cd813d4..bf4e00e 100644 --- a/gkeyldap/cli.py +++ b/gkeyldap/cli.py @@ -223,11 +223,18 @@ class Main(object): if not field: continue try: - values = info[field] + # strip errant line feeds + values = [y.strip('\n') for y in info[field]] if values and values in ['uid', 'cn' ]: value = values[0] + # separate out short/long key id's + elif values and x in ['keyid', 'longkeyid']: + value = get_key_ids(x, values) else: value = values + if 'undefined' in values: + logger.error('%s = "undefined" for %s, %s' + %(field, info['uid'][0], info['cn'][0])) if value: keyinfo[x] = value except KeyError: @@ -245,11 +252,10 @@ class Main(object): keyinfo.append(None) continue try: - values = info[field] # strip errant line feeds - values = [x.strip('\n') for x in values] + values = [y.strip('\n') for y in info[field]] if values and field in ['uid', 'cn' ]: - value = values[0].strip('\n') + value = values[0] # separate out short/long key id's elif values and x in ['keyid', 'longkeyid']: value = get_key_ids(x, values) diff --git a/gkeys/seed.py b/gkeys/seed.py index 544ab02..5cfa5fe 100644 --- a/gkeys/seed.py +++ b/gkeys/seed.py @@ -54,6 +54,7 @@ class Seeds(object): for seed in seedlines: try: + seed = seed.strip('\n') parts = self._split_seed(seed, self.separator) self.seeds.append(GKEY._make(parts)) except Exception as err: