diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 90c359dfd124..a61c81dde5e1 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,8 @@ CHANGELOG Next Release (TBD) ================== +* bugfix:``aws s3 sync``: Fix issue when uploading with ``--exact-timestamps`` + (`issue 964 `__) * bugfix:Retry: Fix issue where certain error codes were not being retried (`botocore issue 361 `__) * bugfix:``aws emr ssh``: Fix issue when using waiter interface to diff --git a/awscli/customizations/s3/syncstrategy/exacttimestamps.py b/awscli/customizations/s3/syncstrategy/exacttimestamps.py index 599341ed14b0..a843178050ff 100644 --- a/awscli/customizations/s3/syncstrategy/exacttimestamps.py +++ b/awscli/customizations/s3/syncstrategy/exacttimestamps.py @@ -50,5 +50,5 @@ def compare_time(self, src_file, dest_file): if cmd == 'download': return self.total_seconds(delta) == 0 else: - return super(SizeOnlySyncStrategy, self).compare_time(src_file, - dest_file) + return super(ExactTimestampsSync, self).compare_time(src_file, + dest_file) diff --git a/tests/unit/customizations/s3/syncstrategy/test_exacttimestamps.py b/tests/unit/customizations/s3/syncstrategy/test_exacttimestamps.py index 480f5de25e91..4ec5ba484fe5 100644 --- a/tests/unit/customizations/s3/syncstrategy/test_exacttimestamps.py +++ b/tests/unit/customizations/s3/syncstrategy/test_exacttimestamps.py @@ -113,6 +113,29 @@ def test_compare_exact_timestamps_same_age_diff_size(self): src_file, dst_file) self.assertTrue(should_sync) + def test_compare_exact_timestamps_diff_age_not_download(self): + """ + Confirm that same sized files are synced when the timestamps differ, + the type of operation is not a download, and ``exact_timestamps`` + is set. + """ + time_src = datetime.datetime.now() + time_dst = time_src - datetime.timedelta(days=1) + + src_file = FileStat(src='', dest='', + compare_key='test.py', size=10, + last_update=time_src, src_type='s3', + dest_type='local', operation_name='upload') + + dst_file = FileStat(src='', dest='', + compare_key='test.py', size=10, + last_update=time_dst, src_type='local', + dest_type='s3', operation_name='') + + should_sync = self.sync_strategy.determine_should_sync( + src_file, dst_file) + self.assertTrue(should_sync) + if __name__ == "__main__": unittest.main()