Ver Fonte

Migrator script fixes.

Stefano Cossu há 6 anos atrás
pai
commit
576a6a2e4c
2 ficheiros alterados com 14 adições e 9 exclusões
  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.
     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
     existing repository. The source repo can be Lakesuperior or
     another LDP-compatible implementation.
     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,
         src, dest, src_auth=src_auth, start_pts=start, list_file=list_file,
             zero_binaries=zero_binaries, skip_errors=skip_errors)
             zero_binaries=zero_binaries, skip_errors=skip_errors)
     logger.info('Migrated {} resources.'.format(entries))
     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.
     Make sure that the default port is not being used by another repository.
-    """.format(dest))
+    ''')
 
 
 
 
 admin.add_command(bootstrap)
 admin.add_command(bootstrap)

+ 6 - 4
lakesuperior/migrator.py

@@ -211,9 +211,11 @@ class Migrator:
         # Determine LDP type.
         # Determine LDP type.
         ldp_type = 'ldp_nr'
         ldp_type = 'ldp_nr'
         try:
         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 (
                 if (
                         link.get('rel') == 'type'
                         link.get('rel') == 'type'
                         and (
                         and (
@@ -269,7 +271,7 @@ class Migrator:
             uuid = str(gr.value(
             uuid = str(gr.value(
                 URIRef(iuri), nsc['premis'].hasMessageDigest)).split(':')[-1]
                 URIRef(iuri), nsc['premis'].hasMessageDigest)).split(':')[-1]
             fpath = self.nonrdfly.local_path(
             fpath = self.nonrdfly.local_path(
-                    self.nonrdfly.config['path'], uuid)
+                    self.nonrdfly.config['location'], uuid)
             makedirs(path.dirname(fpath), exist_ok=True)
             makedirs(path.dirname(fpath), exist_ok=True)
             with open(fpath, 'wb') as fh:
             with open(fpath, 'wb') as fh:
                 fh.write(data)
                 fh.write(data)