Minor fixes

This commit is contained in:
Dane Everitt 2017-03-18 20:52:02 -04:00
parent 4a43c53e07
commit 82b3cbc246
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
3 changed files with 53 additions and 3 deletions

View file

@ -65,16 +65,18 @@ class RebuildServer extends Command
public function handle()
{
if ($this->option('all')) {
$servers = Server::with('node', 'option.variables')->get();
$servers = Server::all();
} elseif ($this->option('node')) {
$servers = Server::with('node', 'option.variables')->where('node_id', $this->option('node'))->get();
$servers = Server::where('node_id', $this->option('node'))->get();
} elseif ($this->option('server')) {
$servers = Server::with('node', 'option.variables')->where('id', $this->option('server'))->get();
$servers = Server::where('id', $this->option('server'))->get();
} else {
$this->error('You must pass a flag to determine which server(s) to rebuild.');
return;
}
$servers->load('node', 'service', 'option.variables', 'pack');
$this->line('Beginning processing, do not exit this script.');
$bar = $this->output->createProgressBar(count($servers));
$results = collect([]);
@ -98,6 +100,11 @@ class RebuildServer extends Command
'image' => $server->image,
'env|overwrite' => $environment->pluck('value', 'variable')->merge(['STARTUP' => $server->startup]),
],
'service' => [
'type' => $server->service->folder,
'option' => $server->option->tag,
'pack' => ! is_null($server->pack) ? $server->pack->uuid : null,
],
],
]);