jfrog / nexus2artifactory

NexusToArtifactory - A tool designed to ease migration from Sonatype Nexus to JFrog Artifactory.
Apache License 2.0
67 stars 54 forks source link

nexus3 migration blobstore failure #28

Closed gamerscomplete closed 6 years ago

gamerscomplete commented 6 years ago

While trying to run a migration from nexus3 to artifactory on an npm repository the script consistently fails with a rather unuseful error. I have looked at the code to try to diagnose the issue, but I am not a python dev at all and couldn't find any reason why it is dieing on this.

Traceback (most recent call last): File "./NexusToArtifactory.py", line 70, in else: initInteractive(setup) File "./NexusToArtifactory.py", line 27, in initInteractive win.show() File "/home/chris/nexus2artifactory/nex2art/core/Menu.py", line 179, in show if self.runact(sel, sel['act']): return File "/home/chris/nexus2artifactory/nex2art/core/Menu.py", line 203, in runact elif hasattr(act, 'call'): cont = self.showCall(sel, act) File "/home/chris/nexus2artifactory/nex2art/core/Menu.py", line 223, in showCall cont = act(sel) File "/home/chris/nexus2artifactory/nex2art/menu/Main.py", line 64, in runmigration status, msg = Progress(self.scr).show(self.scr.state.todict()) File "/home/chris/nexus2artifactory/nex2art/core/Progress.py", line 30, in show result = self.scr.artifactory.migrate(self, conf) File "/home/chris/nexus2artifactory/nex2art/core/Artifactory.py", line 85, in migrate self.upload.upload(conf) File "/home/chris/nexus2artifactory/nex2art/core/Upload.py", line 67, in upload for f in self.filelistgenerator3(conf): queue.put(f) File "/home/chris/nexus2artifactory/nex2art/core/Upload.py", line 171, in filelistgenerator3 if self.isNexus3ChecksumFile(chapdir, blobbase): continue File "/home/chris/nexus2artifactory/nex2art/core/Upload.py", line 413, in isNexus3ChecksumFile blobname = self.acquireMetadata3(blobpropertiesfile)['@BlobStore.blob-name'] KeyError: '@BlobStore.blob-name'

DarthFennec commented 6 years ago

The Nexus 3 filestore consists of .blob and .properties file pairs. The .blob files contain the actual artifact data, and the .properties files contain metadata information such as checksums, the containing repository name, the file path within the repository, and timestamps.

In particular, every artifact must have a @BlobStore.blob-name property, which is the artifact's file path. Without this path, the migrator has no way to tell how the file should be migrated. During the actual migration step, artifacts with bad properties files (such as those missing the file path) are simply skipped.

The function throwing the error is supposed to prevent checksum artifacts (.md5 and .sha1 files) from migrating (Nexus 3 doesn't deal with these files, and neither does Artifactory; these will only exist if the Nexus 3 instance was upgraded from an existing Nexus 2). However, it doesn't seem to have handling for this particular error, which is a bug. I've pushed an update that fixes it, causing it to skip the file instead. Let me know if that helps.

Thanks!

gamerscomplete commented 6 years ago

A rundown of how things work, a diagnosis of the problem, and a working code fix within an hour or so of submitting the issue. I can't even get that on paid support! You're awesome, thanks for your help!