Inconsistencies in displaying bucket and file metadata

Đang mở
#728 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
22/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
cli, cloud

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.
Ngôn ngữ chính
Python
Star
638
Fork
138
Merge trung bình
8 giờ 27 phút
Pull request đã merge (30 ngày)
8

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Backblaze/B2_Command_Line_Tool

Tất cả issue của Backblaze/B2_Command_Line_Tool

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.