config: match.ip is never evaluated and match.path never during auto-selection — documented selection criteria silently ignored

Aperta
#120 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python
Ambito
backend

Direzione di ricerca

Start with src/profiles/core/config/service.py and trace the three select_active_configuration calls named in the issue, then read matcher.py, models.py, and the template examples. Check how get_local_ip() and the working directory are obtained and how path matching is intended to work; the issue leaves the path behavior as a design choice. Done means documented IP and path criteria work as described, or the docs and examples accurately describe the supported behavior, with tests covering the chosen behavior.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

Problem

Every production caller of select_active_configuration hardcodes empty IP and path candidates:

# src/profiles/core/config/service.py:107, 160, 196 — all three
return select_active_configuration(config, hostname, "", "")

And match_pattern returns False when the value is empty (matcher.py:25-26), so match.ip and match.path criteria can never match:

  • get_local_ip() exists (src/profiles/utils/network.py:32, used by collect_system_info) but is never plumbed into matching.
  • The starter template advertises IP matching with a worked example (template.py:337-343 and the commented production config, lines 356-373).
  • MatchCriteria.path is documented as "Glob patterns for paths that must exist on the filesystem" (models.py:163-165) — yet nothing verifies existence; path patterns only participate in post-selection directory matching via find_active_config (service.py:69-71).

Net effect: a user who writes an ip: or path: match criterion silently gets the fallback config, with no diagnostic anywhere.

Suggested fix

  1. Pass get_local_ip() (and a working-directory candidate) into select_active_configuration from find_configuration_by_hostname / auto_select_directory / choose_active_directory.
  2. For path, either implement existence semantics in matches_machine_config (fnmatch each pattern against existing scan/cwd paths) or fix the docstring to state the caller must supply the path — and drop the misleading template example if the feature is not implemented.
Lingua principale
Python
Stelle
1
Fork
1
Merge medio
4h 46m
PR unite (30g)
55

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di falbany/ProFiles

Tutte le issue di falbany/ProFiles

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.