Fix directory creation issue in LocalFileVolume.php and parseDockerComposeFile()
This commit is contained in:
@@ -39,7 +39,7 @@ class LocalFileVolume extends BaseModel
|
|||||||
if (!$fileVolume->is_directory && $isDir == 'NOK') {
|
if (!$fileVolume->is_directory && $isDir == 'NOK') {
|
||||||
$content = base64_encode($content);
|
$content = base64_encode($content);
|
||||||
$commands->push("echo '$content' | base64 -d > $path");
|
$commands->push("echo '$content' | base64 -d > $path");
|
||||||
} else if ($isDir == 'NOK' && $fileVolume->is_directory) {
|
} else if ($isDir == 'NOK' && $fileVolume->is_directory) {
|
||||||
$commands->push("mkdir -p $path > /dev/null 2>&1 || true");
|
$commands->push("mkdir -p $path > /dev/null 2>&1 || true");
|
||||||
}
|
}
|
||||||
ray($commands->toArray());
|
ray($commands->toArray());
|
||||||
|
|||||||
@@ -782,14 +782,14 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
$source = data_get_str($volume, 'source');
|
$source = data_get_str($volume, 'source');
|
||||||
$target = data_get_str($volume, 'target');
|
$target = data_get_str($volume, 'target');
|
||||||
$content = data_get($volume, 'content');
|
$content = data_get($volume, 'content');
|
||||||
$isDirectory = (bool) data_get($volume, 'isDirectory', false);
|
$isDirectory = (bool) data_get($volume, 'isDirectory', false) || (bool) data_get($volume, 'is_directory', false);
|
||||||
$foundConfig = $savedService->fileStorages()->whereMountPath($target)->first();
|
$foundConfig = $savedService->fileStorages()->whereMountPath($target)->first();
|
||||||
if ($foundConfig) {
|
if ($foundConfig) {
|
||||||
$contentNotNull = data_get($foundConfig, 'content');
|
$contentNotNull = data_get($foundConfig, 'content');
|
||||||
if ($contentNotNull) {
|
if ($contentNotNull) {
|
||||||
$content = $contentNotNull;
|
$content = $contentNotNull;
|
||||||
}
|
}
|
||||||
$isDirectory = (bool) data_get($foundConfig, 'is_directory');
|
$isDirectory = (bool) data_get($volume, 'isDirectory', false) || (bool) data_get($volume, 'is_directory', false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($type->value() === 'bind') {
|
if ($type->value() === 'bind') {
|
||||||
@@ -1054,6 +1054,8 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
data_set($service, 'container_name', $containerName);
|
data_set($service, 'container_name', $containerName);
|
||||||
data_forget($service, 'volumes.*.content');
|
data_forget($service, 'volumes.*.content');
|
||||||
data_forget($service, 'volumes.*.isDirectory');
|
data_forget($service, 'volumes.*.isDirectory');
|
||||||
|
data_forget($service, 'volumes.*.is_directory');
|
||||||
|
|
||||||
// Remove unnecessary variables from service.environment
|
// Remove unnecessary variables from service.environment
|
||||||
// $withoutServiceEnvs = collect([]);
|
// $withoutServiceEnvs = collect([]);
|
||||||
// collect(data_get($service, 'environment'))->each(function ($value, $key) use ($withoutServiceEnvs) {
|
// collect(data_get($service, 'environment'))->each(function ($value, $key) use ($withoutServiceEnvs) {
|
||||||
|
|||||||
Reference in New Issue
Block a user