1
This commit is contained in:
+26
-30
@@ -1,38 +1,34 @@
|
|||||||
param(
|
param(
|
||||||
[ValidateSet("apply", "clean")]
|
[ValidateSet('apply','clean')]
|
||||||
[string]$action = "apply"
|
[string]$Action = 'apply'
|
||||||
)
|
)
|
||||||
|
|
||||||
# Start deployment process
|
Write-Host "Deployment Manager started with action: $Action"
|
||||||
Write-Host "Deployment Manager started with action: $action"
|
|
||||||
|
|
||||||
# Define deployment modules and their corresponding actions
|
# Define modules with their respective actions
|
||||||
$deployModules = @(
|
$Modules = @(
|
||||||
@{ Module = "autostartManagerModule"; Apply = "update"; Clean = "remove" },
|
@{ Name = 'autostartManagerModule'; Apply = 'update'; Clean = 'remove' },
|
||||||
@{ Module = "appsDataManagerModule"; Apply = "reconnect"; Clean = "disconnect" },
|
@{ Name = 'appsDataManagerModule'; Apply = 'reconnect'; Clean = 'disconnect' },
|
||||||
@{ Module = "mountsManagerModule"; Apply = "reconnect"; Clean = "disconnect" }
|
@{ Name = 'mountsManagerModule'; Apply = 'reconnect'; Clean = 'disconnect' }
|
||||||
)
|
)
|
||||||
|
|
||||||
foreach ($mod in $deployModules) {
|
foreach ($module in $Modules) {
|
||||||
|
$currentAction = if ($Action -eq 'apply') { $module.Apply } else { $module.Clean }
|
||||||
|
Write-Host "`n=== $($module.Name) : $currentAction"
|
||||||
|
try {
|
||||||
|
# Resolve the script path stored in a variable with the same name
|
||||||
|
$scriptPath = (Get-Variable -Name $module.Name -ErrorAction Stop).Value
|
||||||
|
|
||||||
|
if (Test-Path -LiteralPath $scriptPath) {
|
||||||
|
& $scriptPath $currentAction
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Warning "Module script not found: $scriptPath"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Warning "Could not resolve path for module '$($module.Name)': $_"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "`nDeployment finished."
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@{ Module = "autostartManagerModule"; Apply =
|
|
||||||
Reference in New Issue
Block a user