Pricing guide documents a custom file path that the loader ignores

Ouverte Adaptée aux débutants
#2,225 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
1/5
Temps estimé
1-3 heures
Accessibilité débutants
88/100
Type d'issue
Documentation
Clarté
Clairement spécifiée
Activité
Active
Domaine
documentation

Piste de recherche

Ouvrez docs/compute/pricing.rst et examinez les sections « Using a custom pricing file » et « Updating pricing » citées dans l’issue. Corrigez le chemin du fichier de tarification personnalisé pour qu’il corresponde au chargeur, et alignez la description de la source de téléchargement sur la valeur par défaut actuelle indiquée dans l’issue. Le travail est terminé lorsque les trois références aux chemins et la description obsolète de la source reflètent fidèlement ces valeurs par défaut.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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.

Langage dominant
Python
Étoiles
2.1k
Forks
935
Merge moyen
5 j 3 h
PR mergées (30 j)
15

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de apache/libcloud

Toutes les issues de apache/libcloud

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.