tripe-keys: Provide upload-hook for more complicated publishing.
[tripe] / keys / tripe-keys.in
index 6da6eb4..1167dea 100644 (file)
@@ -129,6 +129,7 @@ def conf_defaults():
                ('sig-file', '${base-dir}${sig-base}'),
                ('repos-file', '${base-dir}${repos-base}'),
                ('conf-file', '${base-dir}tripe-keys.conf'),
+               ('upload-hook', ': run upload hook'),
                ('kx', 'dh'),
                ('kx-param', lambda: {'dh': '-LS -b2048 -B256',
                                      'ec': '-Cnist-p256'}[conf['kx']]),
@@ -182,9 +183,9 @@ Key management utility for TrIPE.
 
 Options supported:
 
--h, --help             Show this help message.
--v, --version          Show the version number.
--u, --usage            Show pointlessly short usage string.
+-h, --help              Show this help message.
+-v, --version           Show the version number.
+-u, --usage             Show pointlessly short usage string.
 
 Subcommands available:
 """
@@ -197,7 +198,7 @@ Subcommands available:
 def master_keys():
   if not OS.path.exists('master'):
     return
-  for k in C.KeyFile('master'):
+  for k in C.KeyFile('master').itervalues():
     if (k.type != 'tripe-keys-master' or
         k.expiredp or
         not k.tag.startswith('master-')):
@@ -279,7 +280,8 @@ def cmd_upload(args):
       OS.rename(new, base)
   finally:
     OS.chdir(cwd)
-    rmtree('tmp')    
+    rmtree('tmp')
+  run('sh -c ${upload-hook}')
 
 def cmd_update(args):
   cwd = OS.getcwd()
@@ -343,7 +345,7 @@ def cmd_clean(args):
 ### Main driver
 
 class UsageError (Exception): pass
-  
+
 commands = {'help': (cmd_help, 0, 1, ''),
             'newmaster': (cmd_newmaster, 0, 0, ''),
             'setup': (cmd_setup, 0, 0, ''),