Skip to content

Commit cb64e3a

Browse files
author
Rakshil Modi
committed
Overridding sync strategy
1 parent 2a32648 commit cb64e3a

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

awscli/customizations/s3/subcommands.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
NeverSync,
4141
SizeAndLastModifiedSync,
4242
)
43-
from awscli.customizations.s3.syncstrategy.nooverwrite import NoOverwriteSync
4443
from awscli.customizations.s3.utils import (
4544
AppendFilter,
4645
RequestParamsMapper,
@@ -1297,15 +1296,10 @@ def choose_sync_strategies(self):
12971296
of its self when the event is emitted.
12981297
"""
12991298
sync_strategies = {}
1300-
if self.parameters.get('no_overwrite'):
1301-
sync_strategies['file_at_src_and_dest_sync_strategy'] = (
1302-
NoOverwriteSync()
1303-
)
1304-
else:
1305-
# Set the default strategies.
1306-
sync_strategies['file_at_src_and_dest_sync_strategy'] = (
1307-
SizeAndLastModifiedSync()
1308-
)
1299+
# Set the default strategies.
1300+
sync_strategies['file_at_src_and_dest_sync_strategy'] = (
1301+
SizeAndLastModifiedSync()
1302+
)
13091303
sync_strategies['file_not_at_dest_sync_strategy'] = MissingFileSync()
13101304
sync_strategies['file_not_at_src_sync_strategy'] = NeverSync()
13111305

@@ -1320,7 +1314,6 @@ def choose_sync_strategies(self):
13201314
sync_type = override_sync_strategy.sync_type
13211315
sync_type += '_sync_strategy'
13221316
sync_strategies[sync_type] = override_sync_strategy
1323-
13241317
return sync_strategies
13251318

13261319
def run(self):

awscli/customizations/s3/syncstrategy/nooverwrite.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# language governing permissions and limitations under the License.
1313
import logging
1414

15+
from awscli.customizations.s3.subcommands import NO_OVERWRITE
1516
from awscli.customizations.s3.syncstrategy.base import BaseSync
1617

1718
LOG = logging.getLogger(__name__)
@@ -24,6 +25,8 @@ class NoOverwriteSync(BaseSync):
2425
overwriting of existing files, regardless of size or modification time differences.
2526
"""
2627

28+
ARGUMENT = NO_OVERWRITE
29+
2730
def determine_should_sync(self, src_file, dest_file):
2831
LOG.debug(
2932
f"warning: skipping {src_file.src} -> {src_file.dest}, file exists at destination"

0 commit comments

Comments
 (0)