Explorar el Código

Migrator script fixes.

Stefano Cossu hace 5 años
padre
commit
576a6a2e4c
Se han modificado 2 ficheros con 14 adiciones y 9 borrados
  1. 8 5
      lakesuperior/lsup_admin.py
  2. 6 4
      lakesuperior/migrator.py

+ 8 - 5
lakesuperior/lsup_admin.py

@@ -191,7 +191,7 @@ def migrate(src, dest, auth, start, list_file, zero_binaries, skip_errors):
     """
     Migrate an LDP repository to Lakesuperior.
 
-    This utility creates a fully functional LAKEshore repository from an
+    This utility creates a fully functional Lakesuperior repository from an
     existing repository. The source repo can be Lakesuperior or
     another LDP-compatible implementation.
 
@@ -208,13 +208,16 @@ def migrate(src, dest, auth, start, list_file, zero_binaries, skip_errors):
         src, dest, src_auth=src_auth, start_pts=start, list_file=list_file,
             zero_binaries=zero_binaries, skip_errors=skip_errors)
     logger.info('Migrated {} resources.'.format(entries))
-    logger.info("""Migration complete. To start the new repository, from the
-    directory you launched this script run:
+    logger.info(f'''
+    Migration complete. A new Lakesuperior environment has been created in
+    {dest}. To start the new repository, run:
 
-    FCREPO_CONFIG_DIR="{}/etc" ./fcrepo
+    FCREPO_CONFIG_DIR="{dest}/etc" fcrepo
+
+    from the directory you launched this script in.
 
     Make sure that the default port is not being used by another repository.
-    """.format(dest))
+    ''')
 
 
 admin.add_command(bootstrap)

+ 6 - 4
lakesuperior/migrator.py

@@ -211,9 +211,11 @@ class Migrator:
         # Determine LDP type.
         ldp_type = 'ldp_nr'
         try:
-            links_rsp = rsp.headers.get('link', auth=self.auth)
-            links_rsp.raise_for_status()
-            for link in requests.utils.parse_header_links(links_rsp):
+            links_rsp = rsp.headers.get('link')
+            head_links = (
+                requests.utils.parse_header_links(links_rsp)
+                if links_rsp else None)
+            for link in head_links:
                 if (
                         link.get('rel') == 'type'
                         and (
@@ -269,7 +271,7 @@ class Migrator:
             uuid = str(gr.value(
                 URIRef(iuri), nsc['premis'].hasMessageDigest)).split(':')[-1]
             fpath = self.nonrdfly.local_path(
-                    self.nonrdfly.config['path'], uuid)
+                    self.nonrdfly.config['location'], uuid)
             makedirs(path.dirname(fpath), exist_ok=True)
             with open(fpath, 'wb') as fh:
                 fh.write(data)