Skip to content

[TUI] Network mode never switches to Static — user gets DHCP config even after entering static IP fields #19

Description

@castrojo

Summary

The TUI applyFields() method in internal/tui/tui.go copies the user-entered interface, address, gateway, and DNS values into cfg.Network, but never sets cfg.Network.Mode = model.NetworkStatic. The mode stays at its zero value (NetworkDHCP).

Steps to Reproduce

  1. Launch knuckle
  2. Advance to the Network step
  3. Fill in Interface, IP Address (CIDR), Gateway, and DNS fields with valid static config
  4. Press Enter to advance
  5. Continue to Review step — observe "Network: dhcp"
  6. Proceed to install — generated Butane YAML has no static network block

Expected

When the user fills in static network fields, cfg.Network.Mode should be set to model.NetworkStatic. The generated Ignition config should contain the 10-static.network systemd unit.

Actual

cfg.Network.Mode remains NetworkDHCP (zero value). The isStatic template function returns false. The static network block is omitted from the Butane output. The user's static IP config is silently ignored.

Root Cause

internal/tui/tui.go lines 141-158: applyFields() for StepNetwork applies individual field values but never sets the network mode:

case model.StepNetwork:
    for _, f := range m.fields {
        switch f.key {
        case "interface":
            cfg.Network.Interface = f.value
        case "address":
            cfg.Network.Address = f.value
        // ... but no: cfg.Network.Mode = model.NetworkStatic

Fix

After applying network fields, if cfg.Network.Address is non-empty, set cfg.Network.Mode = model.NetworkStatic. Alternatively, add a DHCP/Static toggle to the UI.

Severity

Critical — This silently produces an incorrect network configuration. A real user configuring a server with a static IP will boot into DHCP instead, potentially making the machine unreachable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    1-triageNew work awaiting human triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions