Repository: Duke-GCB/lando

Issue:
Error in new DukeDSClient download
```
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/lando/worker/worker.py", line 186, in run
    self.func(working_directory, self.payload)
  File "/usr/local/lib/python3.5/dist-packages/lando/worker/worker.py", line 82, in stage_files
    download_file.run(staging_context)
  File "/usr/local/lib/python3.5/dist-packages/lando/worker/staging.py", line 149, in run
    FileUrlDownloader.check_file_size(dds_file.current_version['size'], self.dest)
KeyError: 'size'
```

It should be `current_version['upload']['size']`. This is a bug from PR #192. I must have accidentally tested that PR with an older bespin worker VM.

Discussion:

Patch:
diff --git a/lando/worker/staging.py b/lando/worker/staging.py
index 9d8680a..e54474f 100644
--- a/lando/worker/staging.py
+++ b/lando/worker/staging.py
@@ -146,7 +146,7 @@ class DownloadDukeDSFile(object):
         dds_file = dds_client.get_file_by_id(self.file_id)
         logging.info("Downloading file id:{} to {}".format(self.file_id, self.dest))
         dds_file.download_to_path(self.dest)
-        FileUrlDownloader.check_file_size(dds_file.current_version['size'], self.dest)
+        FileUrlDownloader.check_file_size(dds_file.current_version['upload']['size'], self.dest)
 
 
 class DownloadURLFile(object):


Test patch:
diff --git a/lando/worker/tests/test_staging.py b/lando/worker/tests/test_staging.py
index 09bd3c2..1c2edbb 100644
--- a/lando/worker/tests/test_staging.py
+++ b/lando/worker/tests/test_staging.py
@@ -125,4 +125,4 @@ class TestDownloadDukeDSFile(TestCase):
         mock_dds_file = mock_duke_ds_client.return_value.get_file_by_id.return_value
         mock_dds_file.download_to_path.assert_called_with('/bespin/data/input.txt')
         mock_file_url_downloader.check_file_size.assert_called_with(
-            mock_dds_file.current_version['size'], '/bespin/data/input.txt')
+            mock_dds_file.current_version['upload']['size'], '/bespin/data/input.txt')