Add reinstall abilities and cleanup process for new servers

This commit is contained in:
Dane Everitt 2017-04-20 18:52:43 -04:00
parent 3fe5d162f5
commit 8dc24471ae
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
9 changed files with 91 additions and 3 deletions

View file

@ -95,7 +95,7 @@ class OptionController extends Controller
$repo = new VariableRepository;
try {
$variable = $repo->create($id, $request->only([
$variable = $repo->create($id, $request->intersect([
'name', 'description', 'env_variable',
'default_value', 'options', 'rules',
]));
@ -200,7 +200,7 @@ class OptionController extends Controller
try {
if ($request->input('action') !== 'delete') {
$variable = $repo->update($variable, $request->only([
$variable = $repo->update($variable, $request->intersect([
'name', 'description', 'env_variable',
'default_value', 'options', 'rules',
]));
@ -233,7 +233,9 @@ class OptionController extends Controller
$repo = new OptionRepository;
try {
$repo->scripts($id, $request->only('script_install'));
$repo->scripts($id, $request->only([
'script_install', 'script_entry', 'script_container',
]));
Alert::success('Successfully updated option scripts to be run when servers are installed.')->flash();
} catch (DisplayValidationException $ex) {
return redirect()->route('admin.services.option.scripts', $id)->withErrors(json_decode($ex->getMessage()));

View file

@ -322,6 +322,30 @@ class ServersController extends Controller
return redirect()->route('admin.servers.view.manage', $id);
}
/**
* Reinstalls the server with the currently assigned pack and service.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\RedirectResponse
*/
public function reinstallServer(Request $request, $id)
{
$repo = new ServerRepository;
try {
$repo->reinstall($id);
Alert::success('Server successfully marked for reinstallation.')->flash();
} catch (DisplayException $ex) {
Alert::danger($ex->getMessage())->flash();
} catch (\Exception $ex) {
Log::error($ex);
Alert::danger('An unhandled exception occured while attemping to perform this reinstallation. This error has been logged.')->flash();
}
return redirect()->route('admin.servers.view.manage', $id);
}
/**
* Setup a server to have a container rebuild.
*