This commit is contained in:
2025-10-11 15:25:37 +03:00
parent da293ae85d
commit a4cf5d01c0
+24 -22
View File
@@ -1,36 +1,38 @@
param(
[ValidateSet("apply","clean")]
[ValidateSet("apply", "clean")]
[string]$action = "apply"
)
# Start deployment process
Write-Host "Deployment Manager started with action: $action"
# Список модулей с аргументами для apply и clean
# Define deployment modules and their corresponding actions
$deployModules = @(
@{ Module = "autostartManager"; Apply = "update"; Clean = "remove" },
@{ Module = "appsDataManager"; Apply = "reconnect"; Clean = "disconnect" },
@{ Module = "autostartManagerModule"; Apply = "update"; Clean = "remove" },
@{ Module = "appsDataManagerModule"; Apply = "reconnect"; Clean = "disconnect" },
@{ Module = "mountsManagerModule"; Apply = "reconnect"; Clean = "disconnect" }
)
foreach ($item in $deployModules) {
$moduleName = $item.Module
$moduleAction = if ($action -eq "apply") { $item.Apply } else { $item.Clean }
foreach ($mod in $deployModules) {
Write-Host "=============================="
Write-Host "Executing module '$moduleName' with action '$moduleAction'"
$modulePath = Join-Path $PSScriptRoot "$moduleName.ps1"
if (Test-Path $modulePath) {
try {
# Передаём аргумент точно так же, как $action передавался бы напрямую модулю
& $modulePath $moduleAction
} catch {
Write-Warning "Module '$moduleName' failed: $($_.Exception.Message)"
}
} else {
Write-Warning "Module script not found: $modulePath"
}
}
Write-Host "Deployment finished."
@{ Module = "autostartManagerModule"; Apply =