From 33a77621520baef9e62dd2a69768ad2232e5e7b6 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 9 May 2020 16:25:22 -0700 Subject: [PATCH] Fix connection issues when changing node FQDN; closes #1931 --- app/Services/Nodes/NodeUpdateService.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/Services/Nodes/NodeUpdateService.php b/app/Services/Nodes/NodeUpdateService.php index 9582c4e18..07901b28a 100644 --- a/app/Services/Nodes/NodeUpdateService.php +++ b/app/Services/Nodes/NodeUpdateService.php @@ -77,6 +77,19 @@ class NodeUpdateService $updated = $this->repository->withFreshModel()->update($node->id, $data, true, true); try { + // If we're changing the FQDN for the node, use the newly provided FQDN for the connection + // address. This should alleviate issues where the node gets pointed to a "valid" FQDN that + // isn't actually running the daemon software, and therefore you can't actually change it + // back. + // + // This makes more sense anyways, because only the Panel uses the FQDN for connecting, the + // node doesn't actually care about this. + // + // @see https://github.com/pterodactyl/panel/issues/1931 + if (! empty($data['fqdn'])) { + $node->fqdn = $data['fqdn']; + } + $this->configurationRepository->setNode($node)->update($updated); } catch (DaemonConnectionException $exception) { if (! is_null($exception->getPrevious()) && $exception->getPrevious() instanceof ConnectException) {