Add reinstall abilities and cleanup process for new servers
This commit is contained in:
parent
3fe5d162f5
commit
8dc24471ae
9 changed files with 91 additions and 3 deletions
|
@ -864,4 +864,25 @@ class ServerRepository
|
|||
]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks a server for reinstallation on the node.
|
||||
*
|
||||
* @param int $id
|
||||
* @return void
|
||||
*/
|
||||
public function reinstall($id)
|
||||
{
|
||||
$server = Models\Server::with('node')->findOrFail($id);
|
||||
|
||||
DB::transaction(function () use ($server) {
|
||||
$server->installed = 0;
|
||||
$server->save();
|
||||
|
||||
$server->node->guzzleClient([
|
||||
'X-Access-Token' => $server->node->daemonSecret,
|
||||
'X-Access-Server' => $server->uuid,
|
||||
])->request('POST', '/server/reinstall');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue