Skip to content

Bug: UDP Tracker Domains Missing from provision Output #412

@josecelano

Description

@josecelano

Overview

The provision command output includes a domains array listing the configured domain names for the deployed environment. When UDP trackers have domains configured (via the domain field in tracker.udp_trackers[].domain of the environment JSON), those domains are absent from the list. Only HTTP-based service domains appear.

Observed output (Hetzner demo deployment #405):

{
  "domains": [
    "http1.torrust-tracker-demo.com",
    "http2.torrust-tracker-demo.com",
    "api.torrust-tracker-demo.com",
    "grafana.torrust-tracker-demo.com"
  ]
}

Expected — UDP domains should also appear:

{
  "domains": [
    "http1.torrust-tracker-demo.com",
    "http2.torrust-tracker-demo.com",
    "udp1.torrust-tracker-demo.com",
    "udp2.torrust-tracker-demo.com",
    "api.torrust-tracker-demo.com",
    "grafana.torrust-tracker-demo.com"
  ]
}

The domains list is used as a DNS-setup reminder — it tells the operator which A/AAAA records need to point at the server IP. A missing UDP domain means the operator does not know they need to create that DNS record.

Root Cause

ProvisionDetailsData::from() in src/presentation/cli/views/commands/provision/view_data/provision_details.rs builds domains by calling services.tls_domain_names():

services
    .tls_domain_names()      // ← only returns TLS service domains
    .iter()
    .map(|s| (*s).to_string())
    .collect()

tls_domain_names() in src/application/command_handlers/show/info/tracker.rs returns only the tls_domains vector — domains associated with HTTPS services (HTTP trackers with TLS proxy, API with TLS proxy, Grafana). UDP trackers are not TLS services and are never added to tls_domains.

The same issue exists in dns_reminder.rs which also calls tls_domain_names().

Proposed Fix

Add a method all_domain_names() -> Vec<&str> to ServiceInfo that returns both TLS service domain names and UDP tracker domain names (where UdpTrackerConfig::domain() is Some). Update provision_details.rs and dns_reminder.rs to call the new method.

Affected Files

  • src/application/command_handlers/show/info/tracker.rs — add all_domain_names() to ServiceInfo
  • src/presentation/cli/views/commands/provision/view_data/provision_details.rs — use all_domain_names()
  • src/presentation/cli/views/commands/provision/view_data/dns_reminder.rs — use all_domain_names()

Acceptance Criteria

  • provision output domains array includes UDP tracker domain names when the environment config supplies a domain for UDP trackers
  • provision output domains array does not include entries for UDP trackers that have no domain configured (IP-only UDP trackers)
  • The DNS setup reminder shown after provision also includes UDP tracker domains
  • tls_domain_names() is kept unchanged — the HTTPS-specific TLS hint is not affected
  • Unit tests for all_domain_names() cover both the UDP-with-domain and UDP-without-domain cases
  • Pre-commit checks pass: ./scripts/pre-commit.sh

Spec

See docs/issues/ for the full issue specification.

Related

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions