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 diff --git a/pdm.lock b/pdm.lock index eab8803b..4f867374 100644 --- a/pdm.lock +++ b/pdm.lock @@ -5,7 +5,7 @@ groups = ["default", "bundle", "doc", "format", "full", "license", "lint", "release", "test"] strategy = ["cross_platform", "inherit_metadata"] lock_version = "4.4.1" -content_hash = "sha256:c41ed236c40d0db7d7eeaf871f99aad2ff11e96179c48761a035ff3e43f314c9" +content_hash = "sha256:57332fd8bf618b915bf75e2c4d01f2828b5e9965569791d326619ae4c6257c10" [[package]] name = "alabaster" @@ -100,7 +100,7 @@ files = [ [[package]] name = "b2sdk" -version = "2.1.0" +version = "2.2.0" requires_python = ">=3.7" summary = "Backblaze B2 SDK" groups = ["default"] @@ -111,8 +111,8 @@ dependencies = [ "typing-extensions>=4.7.1; python_version < \"3.12\"", ] files = [ - {file = "b2sdk-2.1.0-py3-none-any.whl", hash = "sha256:c88c9ca94034b5c490884280f921df10a3fa98a757eccca3fb57fb257fb04bde"}, - {file = "b2sdk-2.1.0.tar.gz", hash = "sha256:39116cc539ffa09c45eb9802b96416efafd255698d514303bdf3b7f7cf105f3f"}, + {file = "b2sdk-2.2.0-py3-none-any.whl", hash = "sha256:85b60caac9616792fd36e6e36156df07f5a4b7178dc8838d6fd23daff47e21b9"}, + {file = "b2sdk-2.2.0.tar.gz", hash = "sha256:b8a2668a8a2232e5f477761c9ee188f27b5b04618309efe99b8f14e1c46193ad"}, ] [[package]] diff --git a/pyproject.toml b/pyproject.toml index f4591385..c8d3e144 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,7 +25,7 @@ classifiers = [ dependencies = [ "argcomplete>=2,<4", "arrow>=1.0.2,<2.0.0", - "b2sdk>=2.1.0,<3", + "b2sdk>=2.2.0,<3", "docutils>=0.18.1", "idna~=3.4; platform_system == 'Java'", "importlib-metadata>=3.3; python_version < '3.8'",