Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/Command/ExApp/Register.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$auth = [];
if ($daemonConfig->getAcceptsDeployId() === $this->dockerActions->getAcceptsDeployId()) {
$deployParams = $this->dockerActions->buildDeployParams($daemonConfig, $appInfo);
$deployResult = $this->dockerActions->deployExApp($exApp, $daemonConfig, $deployParams);
if (boolval($exApp->getDeployConfig()['harp'] ?? false)) {
$deployResult = $this->dockerActions->deployExAppHarp($exApp, $daemonConfig, $deployParams);
} else {
$deployResult = $this->dockerActions->deployExApp($exApp, $daemonConfig, $deployParams);
}
if ($deployResult) {
$this->logger->error(sprintf('ExApp %s deployment failed. Error: %s', $appId, $deployResult));
if ($outputConsole) {
Expand Down
58 changes: 37 additions & 21 deletions lib/Command/ExApp/Unregister.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,29 +97,45 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}
if ($daemonConfig->getAcceptsDeployId() === $this->dockerActions->getAcceptsDeployId()) {
$this->dockerActions->initGuzzleClient($daemonConfig);
$removeResult = $this->dockerActions->removeContainer(
$this->dockerActions->buildDockerUrl($daemonConfig), $this->dockerActions->buildExAppContainerName($appId)
);
if ($removeResult) {
if (!$silent) {
$output->writeln(sprintf('Failed to remove ExApp %s container', $appId));
}
if (!$force) {
return 1;

if (boolval($exApp->getDeployConfig()['harp'] ?? false)) {
if ($this->dockerActions->removeExApp($this->dockerActions->buildDockerUrl($daemonConfig), $exApp->getAppid(), removeData: $rmData)) {
if (!$silent) {
$output->writeln(sprintf('Failed to remove ExApp %s', $appId));
}
if (!$force) {
return 1;
}
} else {
if (!$silent) {
$output->writeln(sprintf('ExApp %s successfully removed', $appId));
}
}
} elseif (!$silent) {
$output->writeln(sprintf('ExApp %s container successfully removed', $appId));
}
if ($rmData) {
$volumeName = $this->dockerActions->buildExAppVolumeName($appId);
$removeVolumeResult = $this->dockerActions->removeVolume(
$this->dockerActions->buildDockerUrl($daemonConfig), $volumeName
} else {
$removeResult = $this->dockerActions->removeContainer(
$this->dockerActions->buildDockerUrl($daemonConfig), $this->dockerActions->buildExAppContainerName($appId)
);
if (!$silent) {
if (isset($removeVolumeResult['error'])) {
$output->writeln(sprintf('Failed to remove ExApp %s volume: %s', $appId, $volumeName));
} else {
$output->writeln(sprintf('ExApp %s data volume successfully removed', $appId));
if ($removeResult) {
if (!$silent) {
$output->writeln(sprintf('Failed to remove ExApp %s container', $appId));
}
if (!$force) {
return 1;
}
} elseif (!$silent) {
$output->writeln(sprintf('ExApp %s container successfully removed', $appId));
}
if ($rmData) {
$volumeName = $this->dockerActions->buildExAppVolumeName($appId);
$removeVolumeResult = $this->dockerActions->removeVolume(
$this->dockerActions->buildDockerUrl($daemonConfig), $volumeName
);
if (!$silent) {
if (isset($removeVolumeResult['error'])) {
$output->writeln(sprintf('Failed to remove ExApp %s volume: %s', $appId, $volumeName));
} else {
$output->writeln(sprintf('ExApp %s data volume successfully removed', $appId));
}
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion lib/Command/ExApp/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,11 @@ private function updateExApp(InputInterface $input, OutputInterface $output, str
$auth = [];
if ($daemonConfig->getAcceptsDeployId() === $this->dockerActions->getAcceptsDeployId()) {
$deployParams = $this->dockerActions->buildDeployParams($daemonConfig, $appInfo);
$deployResult = $this->dockerActions->deployExApp($exApp, $daemonConfig, $deployParams);
if (boolval($exApp->getDeployConfig()['harp'] ?? false)) {
$deployResult = $this->dockerActions->deployExAppHarp($exApp, $daemonConfig, $deployParams);
} else {
$deployResult = $this->dockerActions->deployExApp($exApp, $daemonConfig, $deployParams);
}
if ($deployResult) {
$this->logger->error(sprintf('ExApp %s deployment update failed. Error: %s', $appId, $deployResult));
if ($outputConsole) {
Expand Down
12 changes: 8 additions & 4 deletions lib/Controller/ExAppsPageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -441,10 +441,14 @@ public function uninstallApp(string $appId, bool $removeContainer = true, bool $
$daemonConfig = $this->daemonConfigService->getDaemonConfigByName($exApp->getDaemonConfigName());
if ($daemonConfig->getAcceptsDeployId() === $this->dockerActions->getAcceptsDeployId()) {
$this->dockerActions->initGuzzleClient($daemonConfig);
if ($removeContainer) {
$this->dockerActions->removeContainer($this->dockerActions->buildDockerUrl($daemonConfig), $this->dockerActions->buildExAppContainerName($appId));
if ($removeData) {
$this->dockerActions->removeVolume($this->dockerActions->buildDockerUrl($daemonConfig), $this->dockerActions->buildExAppVolumeName($appId));
if (boolval($exApp->getDeployConfig()['harp'] ?? false)) {
$this->dockerActions->removeExApp($this->dockerActions->buildDockerUrl($daemonConfig), $exApp->getAppid(), removeData: $removeData);
} else {
if ($removeContainer) {
$this->dockerActions->removeContainer($this->dockerActions->buildDockerUrl($daemonConfig), $this->dockerActions->buildExAppContainerName($appId));
if ($removeData) {
$this->dockerActions->removeVolume($this->dockerActions->buildDockerUrl($daemonConfig), $this->dockerActions->buildExAppVolumeName($appId));
}
}
}
}
Expand Down
Loading