+ result = {}
+ result.update(default_config)
+ result.update(changes)
+ return result
+
+def setup_server_key(config_dict):
+ hrn = config_dict.get('GENI_INTERFACE_HRN')
+ if not hrn: return
+
+ # Get the path to the authorities directory hierarchy
+ hierarchy = Hierarchy()
+ path = hierarchy.basedir
+ auth_path = hrn.replace(".", os.sep)
+
+ # define some useful variables
+ key = 'server.key'
+ cert = 'server.cert'
+ hrn_leaf = get_leaf(hrn)
+ if not hrn_leaf:
+ hrn_leaf = hrn
+ new_server_key = os.sep.join([path, auth_path, hrn_leaf]) + ".pkey"
+ old_server_key = os.sep.join([path, key])
+ old_server_cert = os.sep.join([path, cert])
+
+ # remove old key/cert
+ for fd in [old_server_key, old_server_cert]:
+ if os.path.isfile(fd):
+ os.remove(fd)
+
+ # create new server.key
+ distutils.file_util.copy_file(src=new_server_key, dst=old_server_key, verbose=1)
+ print "\t\t%(old_server_key)s\ncopied from\t%(new_server_key)s" % locals()
+
+
+