Pricing guide documents a custom file path that the loader ignores

Abierto Apto para principiantes
#2,225 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
1/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
88/100
Tipo de issue
Documentación
Claridad
Bien especificado
Estado de actividad
Activo

Línea de trabajo

Abre docs/compute/pricing.rst y revisa las secciones “Using a custom pricing file” y “Updating pricing” citadas en la issue. Corrige la ruta de precios personalizada para que coincida con el cargador y ajusta la descripción del origen de descarga al valor predeterminado actual indicado en la issue. El trabajo estará terminado cuando las tres referencias a rutas y la descripción obsoleta del origen reflejen correctamente esos valores predeterminados.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Python
Estrellas
2.1k
Forks
935
Merge medio
5 d 3 h
PR fusionados (30 d)
15

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de apache/libcloud

Todos los issues de apache/libcloud

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.