Pricing guide documents a custom file path that the loader ignores

Đang mở Phù hợp với người mới
#2,225 0 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ó
1/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
88/100
Loại issue
Tài liệu
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Lĩnh vực
documentation

Hướng nghiên cứu

Mở docs/compute/pricing.rst và xem lại các phần “Using a custom pricing file” và “Updating pricing” được nêu trong issue. Sửa đường dẫn giá tùy chỉnh cho khớp với loader, đồng thời điều chỉnh mô tả nguồn tải xuống theo mặc định hiện tại được ghi trong issue. Hoàn thành khi cả ba tham chiếu đường dẫn và mô tả nguồn đã lỗi thời đều phản ánh chính xác các mặc định đó.

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

Mô tả

Summary

The pricing guide tells users to put custom pricing in ~/.libcloud.pricing.json, but Libcloud reads ~/.libcloud/pricing.json. Following the documented setup leaves the custom data unused.

At current trunk 8a0ef6260680625d54fce5093d2315e0926a7dc9, the incorrect path appears twice under Using a custom pricing file and once under Updating pricing in docs/compute/pricing.rst.

Detailed Information

Reproduced with Python 3.12 on Linux using unchanged Libcloud 4.0.0.dev0. This uses temporary directories and fresh subprocesses, so an existing home-directory file or in-memory pricing cache does not affect the result. No cloud service or pricing-data download is involved.

import json
import os
import subprocess
import sys
import tempfile
from pathlib import Path

probe = '''
from libcloud import pricing
path = pricing.get_pricing_file_path()
print("selected", "custom" if path == pricing.CUSTOM_PRICING_FILE_PATH else "bundled")
try:
    print("price", pricing.get_size_price("compute", "local_probe", "small"))
except KeyError:
    print("custom driver unavailable")
'''

with tempfile.TemporaryDirectory() as tmp:
    home = Path(tmp)
    content = json.dumps({"compute": {"local_probe": {"small": 0.125}}, "storage": {}})
    (home / ".libcloud.pricing.json").write_text(content)
    env = dict(os.environ, HOME=tmp)
    subprocess.run([sys.executable, "-c", probe], env=env, check=True)
    # selected bundled
    # custom driver unavailable

    (home / ".libcloud").mkdir()
    (home / ".libcloud" / "pricing.json").write_text(content)
    subprocess.run([sys.executable, "-c", probe], env=env, check=True)
    # selected custom
    # price 0.125

The expected documentation path is ~/.libcloud/pricing.json, matching CUSTOM_PRICING_FILE_PATH, get_pricing_file_path() and the existing upgrade notes. With the documented dot-separated path, the loader silently falls back to bundled data; for this synthetic custom-only driver the lookup then raises KeyError.

The Updating pricing paragraph also says the default download source is the git repository, while the function currently defaults to DEFAULT_FILE_URL_S3_BUCKET; the preceding section already describes that S3 service. It would be useful to bring that paragraph into line with the current defaults at the same time.

This is a documentation report, not a change to actual prices or a claim about provider billing. No full test suite or live download was run.

Ngôn ngữ chính
Python
Star
2.1k
Fork
935
Merge trung bình
5 ngày 3 giờ
Pull request đã merge (30 ngày)
15

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 apache/libcloud

Tất cả issue của apache/libcloud

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.