mirror of
https://github.com/bunny-lab-io/Borealis.git
synced 2025-10-26 15:21:57 -06:00
Provision reusable Ansible execution environment
This commit is contained in:
21
Update.ps1
21
Update.ps1
@@ -497,6 +497,8 @@ function Invoke-BorealisUpdate {
|
||||
|
||||
$preservePath = Join-Path $scriptDir "Data\Server\Python_API_Endpoints\Tesseract-OCR"
|
||||
$preserveBackupPath = Join-Path $scriptDir "Update_Staging\Tesseract-OCR"
|
||||
$ansibleEePath = Join-Path $scriptDir "Agent\Ansible_EE"
|
||||
$ansibleEeBackupPath = Join-Path $scriptDir "Update_Staging\Ansible_EE"
|
||||
|
||||
Run-Step "Updating: Move Tesseract-OCR Folder Somewhere Safe to Restore Later" {
|
||||
if (Test-Path $preservePath) {
|
||||
@@ -506,6 +508,17 @@ function Invoke-BorealisUpdate {
|
||||
}
|
||||
}
|
||||
|
||||
Run-Step "Updating: Preserve Ansible Execution Environment" {
|
||||
if (Test-Path $ansibleEePath) {
|
||||
$stagingPath = Join-Path $scriptDir "Update_Staging"
|
||||
if (-not (Test-Path $stagingPath)) { New-Item -ItemType Directory -Force -Path $stagingPath | Out-Null }
|
||||
if (Test-Path $ansibleEeBackupPath) {
|
||||
Remove-Item -Path $ansibleEeBackupPath -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
Move-Item -Path $ansibleEePath -Destination $ansibleEeBackupPath -Force
|
||||
}
|
||||
}
|
||||
|
||||
Run-Step "Updating: Clean Up Folders to Prepare for Update" {
|
||||
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue `
|
||||
(Join-Path $scriptDir "Data"), `
|
||||
@@ -575,6 +588,14 @@ function Invoke-BorealisUpdate {
|
||||
}
|
||||
}
|
||||
|
||||
Run-Step "Updating: Restore Ansible Execution Environment" {
|
||||
$restorePath = Join-Path $scriptDir "Agent"
|
||||
if (Test-Path $ansibleEeBackupPath) {
|
||||
if (-not (Test-Path $restorePath)) { New-Item -ItemType Directory -Force -Path $restorePath | Out-Null }
|
||||
Move-Item -Path $ansibleEeBackupPath -Destination $restorePath -Force
|
||||
}
|
||||
}
|
||||
|
||||
Run-Step "Updating: Clean Up Update Staging Folder" {
|
||||
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue $stagingPath
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user