mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-28 09:14:44 +02:00
Merge pull request #316 from pelican-dev/issue/node-update
Fix Node Updating
This commit is contained in:
commit
9ce262bf56
@ -27,6 +27,8 @@ class NodeUpdateService
|
||||
*/
|
||||
public function handle(Node $node, array $data, bool $resetToken = false): Node
|
||||
{
|
||||
$data['id'] = $node->id;
|
||||
|
||||
if ($resetToken) {
|
||||
$data['daemon_token'] = Str::random(Node::DAEMON_TOKEN_LENGTH);
|
||||
$data['daemon_token_id'] = Str::random(Node::DAEMON_TOKEN_ID_LENGTH);
|
||||
@ -35,15 +37,9 @@ class NodeUpdateService
|
||||
[$updated, $exception] = $this->connection->transaction(function () use ($data, $node) {
|
||||
/** @var \App\Models\Node $updated */
|
||||
$updated = $node->replicate();
|
||||
$updated->exists = true;
|
||||
$updated->forceFill($data)->save();
|
||||
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.
|
||||
$node->fqdn = $updated->fqdn;
|
||||
|
||||
$this->configurationRepository->setNode($node)->update($updated);
|
||||
|
Loading…
x
Reference in New Issue
Block a user