complete..

This commit is contained in:
2025-10-10 23:09:48 +03:00
parent a708387ddd
commit 9ece0152e4
8 changed files with 46 additions and 182 deletions
+36
View File
@@ -0,0 +1,36 @@
param(
[ValidateSet("apply","clean")]
[string]$action = "apply"
)
Write-Host "Deployment Manager started with action: $action"
# Список модулей с аргументами для apply и clean
$deployModules = @(
@{ Module = "autostartManager"; Apply = "update"; Clean = "remove" },
@{ Module = "appsDataManager"; 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 }
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."