refactor: Improve handling of Docker volumes in parseDockerComposeFile function
This commit is contained in:
parent
023ee5db99
commit
31e02a154c
@ -911,7 +911,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
} else if ($type->value() === 'volume') {
|
} else if ($type->value() === 'volume') {
|
||||||
if ($topLevelVolumes->has($source->value())) {
|
if ($topLevelVolumes->has($source->value())) {
|
||||||
$v = $topLevelVolumes->get($source->value());
|
$v = $topLevelVolumes->get($source->value());
|
||||||
if (data_get($v, 'driver_opts')) {
|
if (data_get($v, 'driver_opts.type') === 'cifs') {
|
||||||
return $volume;
|
return $volume;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1370,13 +1370,14 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
$volume = str("$name:$mount");
|
$volume = str("$name:$mount");
|
||||||
if ($topLevelVolumes->has($name)) {
|
if ($topLevelVolumes->has($name)) {
|
||||||
$v = $topLevelVolumes->get($name);
|
$v = $topLevelVolumes->get($name);
|
||||||
if (data_get($v, 'driver_opts')) {
|
if (data_get($v, 'driver_opts.type') === 'cifs') {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
} else {
|
||||||
if (is_null(data_get($v, 'name'))) {
|
if (is_null(data_get($v, 'name'))) {
|
||||||
data_set($v, 'name', $name);
|
data_set($v, 'name', $name);
|
||||||
}
|
|
||||||
data_set($topLevelVolumes, $name, $v);
|
data_set($topLevelVolumes, $name, $v);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$topLevelVolumes->put($name, [
|
$topLevelVolumes->put($name, [
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
@ -1385,13 +1386,13 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
} else {
|
} else {
|
||||||
if ($topLevelVolumes->has($name->value())) {
|
if ($topLevelVolumes->has($name->value())) {
|
||||||
$v = $topLevelVolumes->get($name->value());
|
$v = $topLevelVolumes->get($name->value());
|
||||||
if (data_get($v, 'driver_opts')) {
|
if (data_get($v, 'driver_opts.type') === 'cifs') {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
} else {
|
||||||
if (is_null(data_get($v, 'name'))) {
|
if (is_null(data_get($v, 'name'))) {
|
||||||
data_set($v, 'name', $name->value());
|
|
||||||
}
|
|
||||||
data_set($topLevelVolumes, $name->value(), $v);
|
data_set($topLevelVolumes, $name->value(), $v);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$topLevelVolumes->put($name->value(), [
|
$topLevelVolumes->put($name->value(), [
|
||||||
'name' => $name->value(),
|
'name' => $name->value(),
|
||||||
@ -1442,13 +1443,14 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
if (!str($source)->startsWith('/')) {
|
if (!str($source)->startsWith('/')) {
|
||||||
if ($topLevelVolumes->has($source)) {
|
if ($topLevelVolumes->has($source)) {
|
||||||
$v = $topLevelVolumes->get($source);
|
$v = $topLevelVolumes->get($source);
|
||||||
if (data_get($v, 'driver_opts')) {
|
if (data_get($v, 'driver_opts.type') === 'cifs') {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
} else {
|
||||||
if (is_null(data_get($v, 'name'))) {
|
if (is_null(data_get($v, 'name'))) {
|
||||||
data_set($v, 'name', $source);
|
data_set($v, 'name', $source);
|
||||||
}
|
|
||||||
data_set($topLevelVolumes, $source, $v);
|
data_set($topLevelVolumes, $source, $v);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$topLevelVolumes->put($source, [
|
$topLevelVolumes->put($source, [
|
||||||
'name' => $source,
|
'name' => $source,
|
||||||
|
Loading…
Reference in New Issue
Block a user