diff --git a/b2/_internal/b2v3/registry.py b/b2/_internal/b2v3/registry.py index 39998db3..2f9ac252 100644 --- a/b2/_internal/b2v3/registry.py +++ b/b2/_internal/b2v3/registry.py @@ -13,6 +13,7 @@ from b2._internal._cli.b2api import _get_b2api_for_profile from b2._internal.arg_parser import enable_camel_case_arguments from .rm import Rm +from .sync import Sync enable_camel_case_arguments() diff --git a/b2/_internal/b2v3/sync.py b/b2/_internal/b2v3/sync.py new file mode 100644 index 00000000..b07c6539 --- /dev/null +++ b/b2/_internal/b2v3/sync.py @@ -0,0 +1,16 @@ +###################################################################### +# +# File: b2/_internal/b2v3/sync.py +# +# Copyright 2024 Backblaze Inc. All Rights Reserved. +# +# License https://www.backblaze.com/using_b2_code.html +# +###################################################################### + +from b2._internal.b2v4.registry import Sync as SyncV4 + + +class Sync(SyncV4): + __doc__ = SyncV4.__doc__ + FAIL_ON_REPORTER_ERRORS_OR_WARNINGS = False diff --git a/b2/_internal/console_tool.py b/b2/_internal/console_tool.py index 0ecc0601..881427eb 100644 --- a/b2/_internal/console_tool.py +++ b/b2/_internal/console_tool.py @@ -2972,6 +2972,8 @@ class Sync( DEFAULT_DOWNLOAD_THREADS = 10 DEFAULT_UPLOAD_THREADS = 10 + FAIL_ON_REPORTER_ERRORS_OR_WARNINGS = True + @classmethod def _setup_parser(cls, parser): add_normalized_argument(parser, '--no-progress', action='store_true') @@ -3089,6 +3091,8 @@ def _run(self, args): raise CommandError(f'{ex.path} is not a directory') except UnableToCreateDirectory as ex: raise CommandError(f'unable to create directory {ex.path}') + if self.FAIL_ON_REPORTER_ERRORS_OR_WARNINGS and reporter.has_errors_or_warnings(): + return 1 return 0 def get_policies_manager_from_args(self, args): diff --git a/changelog.d/+sync-status-code.changed.md b/changelog.d/+sync-status-code.changed.md new file mode 100644 index 00000000..7f376745 --- /dev/null +++ b/changelog.d/+sync-status-code.changed.md @@ -0,0 +1 @@ +Changed `sync` command exit status code from 0 to 1 if any warnings or errors were encountered during the operation. \ No newline at end of file