host($run); if (blank($host->wg_ip)) { return StepResult::fail('The host has no management address to publish.'); } // Der Name steht seit dem Anlegen fest (StartHostOnboarding → // HostName::claim). Dieser Schritt bildete ihn früher ein zweites Mal // — daher kamen zwei Namen für dieselbe Maschine, von denen nur einer // auflöste. Er veröffentlicht jetzt nur noch, was schon gilt. $name = $host->name; $fqdn = HostName::fqdn($name); try { $this->dns->write($name, $fqdn, $host->wg_ip); } catch (Throwable $e) { // Retried first: the write is idempotent (overwrite-by-name), so a // retry after a transient failure (e.g. the shared volume briefly // unavailable) just rewrites the same entry rather than risking a // half-written file. $allowed = min(3, (int) $run->max_attempts); if ($run->attempt + 1 < $allowed) { return StepResult::retry(30, 'DNS unavailable: '.$e->getMessage()); } // Out of attempts: a name is convenience, and a host that is // otherwise ready should not be stranded for the want of one. $run->events()->create([ 'step' => $this->key(), 'outcome' => 'info', 'message' => 'DNS name could not be registered: '.$e->getMessage(), ]); return StepResult::advance(); } return StepResult::advance(); } }