Inconsistencies in displaying bucket and file metadata

オープン
#728 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
22/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python
領域
cli, cloud

調査の方向性

Start by comparing the JSON output of b2 ls --json and b2 get-file-info, then b2 list-buckets --json, b2 get-bucket and b2 update-bucket, to see where fileRetention, legalHold and defaultServerSideEncryption diverge. The issue says b2 ls --json builds FileVersionInfo objects before serialising, so check that conversion. Done would mean one agreed output shape for each field, which needs a maintainer decision on the proposed "mode": "unknown" value first.

索引モデルが issue の本文から書いたものです。

説明

As of now there are several inconsistencies when it comes to displaying:

  • bucket default encyrption
  • file retention

in

  • b2 ls --json and b2 get-file-info
  • b2 list-buckets --json, b2 get-bucket and b2 update-bucket

The inconsistencies are:

  1. FILE INCONSISTENCIES
  • b2 get-file-info displays raw data from server, therefore fileRetention and legalHold contain authorization data, and are of the form:
    "fileRetention": {
        "isClientAuthorizedToRead": true,
        "value": {
            "mode": null,
            "retainUntilTimestamp": null
        }
    },
    "legalHold": {
        "isClientAuthorizedToRead": true,
        "value": null
    }

or

    "fileRetention": {
        "isClientAuthorizedToRead": false,
        "value": null
    },
    "legalHold": {
        "isClientAuthorizedToRead": false,
        "value": null
    }
  • b2 ls --json displays data by converting it to FileVersionInfo objects and then serialising it to dicts, therefore fileRetention and legalHold do not explicitly contain isClientAuthorizedToRead. Instead, information about permission to read can be inferred from the displayed value.

For an application key authorized to read these attributes the output looks like:

        "fileRetention": {
            "mode": null,
            "retainUntilTimestamp": null
        },
        "legalHold": "off"

and for an unauthorized one like:

        "fileRetention": {
            "mode": "unknown",
            "retainUntilTimestamp": null
        },
        "legalHold": "unknown",
  1. BUCKET INCONSISTENCIES

A very similar inconsistency is visible in b2 get-bucket and b2 update-bucket. The latter one returns raw data as received from server (with isClientAuthorizedToRead).

  1. BUCKET AMBIGUITY
    displaying default bucket encryption can be vague depending on key capabilities.

For a key that does not have the permissions to read bucket default encryption the output looks like:

    "defaultServerSideEncryption": {
        "mode": null
    }

And for a bucket with no default encryption and a key with reading capabilities it looks like:

        "defaultServerSideEncryption": {
            "mode": "none"
        },

The difference is hard to spot, but it's there.

I suggest treating these inconsistencies as bugs and fix them without releasing a major version of the CLI. The solutions I suggest:

  1. use the b2 ls --json format everywhere
  2. use the b2 get-bucket and b2 list-buckets --json format everywhere
    3.. introduce a possible value of "mode": "unknown" and for buckets with no default encryption use "mode": null.
主要言語
Python
スター
638
フォーク
138
平均マージ
8時間 27分
マージ済み PR(30日)
8

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Backblaze/B2_Command_Line_Tool のほかの issue

Backblaze/B2_Command_Line_Tool の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。