Skip to content

Commit

Permalink
fix create-key --all-capabilities when account doesnt have access t…
Browse files Browse the repository at this point in the history
…o notification-rules cap
  • Loading branch information
mjurbanski-reef committed Apr 23, 2024
1 parent 6a78575 commit 538818d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion b2/_internal/console_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -1643,7 +1643,14 @@ def _run(self, args):
bucket_id_or_none = self.api.get_bucket_by_name(args.bucket).id_

if args.all_capabilities:
args.capabilities = ALL_CAPABILITIES
current_key_caps = set(self.api.account_info.get_allowed()['capabilities'])
preview_feature_caps = {
'readBucketNotifications',
'writeBucketNotifications',
}
args.capabilities = sorted(
set(ALL_CAPABILITIES) - preview_feature_caps | current_key_caps
)

application_key = self.api.create_key(
capabilities=args.capabilities,
Expand Down
1 change: 1 addition & 0 deletions changelog.d/+create_key.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix `create-key --all-capabilities` erroring out when new b2sdk is installed.

0 comments on commit 538818d

Please sign in to comment.