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
|
@ -173,6 +173,8 @@ class OptionRepository
|
|||
$validator = Validator::make($data, [
|
||||
'script_install' => 'sometimes|nullable|string',
|
||||
'script_is_privileged' => 'sometimes|required|boolean',
|
||||
'script_entry' => 'sometimes|required|string',
|
||||
'script_container' => 'sometimes|required|string',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
|
|
|
@ -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');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue