Update panel to send correct service option configuration to the daemon.

This commit is contained in:
Dane Everitt 2017-10-05 23:09:43 -05:00
parent 1a5a1f82e7
commit 38075c6b9f
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
12 changed files with 282 additions and 83 deletions

View file

@ -12,12 +12,17 @@ namespace Pterodactyl\Console\Commands\Server;
use Webmozart\Assert\Assert;
use Illuminate\Console\Command;
use GuzzleHttp\Exception\RequestException;
use Pterodactyl\Services\Servers\EnvironmentService;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Services\Servers\ServerConfigurationStructureService;
use Pterodactyl\Contracts\Repository\Daemon\ServerRepositoryInterface as DaemonServerRepositoryInterface;
class RebuildServerCommand extends Command
{
/**
* @var \Pterodactyl\Services\Servers\ServerConfigurationStructureService
*/
protected $configurationStructureService;
/**
* @var \Pterodactyl\Contracts\Repository\Daemon\ServerRepositoryInterface
*/
@ -28,11 +33,6 @@ class RebuildServerCommand extends Command
*/
protected $description = 'Rebuild a single server, all servers on a node, or all servers on the panel.';
/**
* @var \Pterodactyl\Services\Servers\EnvironmentService
*/
protected $environmentService;
/**
* @var \Pterodactyl\Contracts\Repository\ServerRepositoryInterface
*/
@ -49,18 +49,18 @@ class RebuildServerCommand extends Command
* RebuildServerCommand constructor.
*
* @param \Pterodactyl\Contracts\Repository\Daemon\ServerRepositoryInterface $daemonRepository
* @param \Pterodactyl\Services\Servers\EnvironmentService $environmentService
* @param \Pterodactyl\Services\Servers\ServerConfigurationStructureService $configurationStructureService
* @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $repository
*/
public function __construct(
DaemonServerRepositoryInterface $daemonRepository,
EnvironmentService $environmentService,
ServerConfigurationStructureService $configurationStructureService,
ServerRepositoryInterface $repository
) {
parent::__construct();
$this->configurationStructureService = $configurationStructureService;
$this->daemonRepository = $daemonRepository;
$this->environmentService = $environmentService;
$this->repository = $repository;
}
@ -74,19 +74,7 @@ class RebuildServerCommand extends Command
$servers->each(function ($server) use ($bar) {
$bar->clear();
$json = [
'build' => [
'image' => $server->image,
'env|overwrite' => $this->environmentService->process($server),
],
'service' => [
'type' => $server->option->service->folder,
'option' => $server->option->tag,
'pack' => object_get($server, 'pack.uuid'),
'skip_scripts' => $server->skip_scripts,
],
'rebuild' => true,
];
$json = array_merge($this->configurationStructureService->handle($server), ['rebuild' => true]);
try {
$this->daemonRepository->setNode($server->node_id)->setAccessServer($server->uuid)->update($json);