Skip to content

Commit

Permalink
Merge pull request #679 from ministryofjustice/DSO/DSOS-2550/fix-serv…
Browse files Browse the repository at this point in the history
…er-2022-ami-psreadline

Dso/dsos 2550/fix server 2022 ami psreadline
  • Loading branch information
robertsweetman authored Jan 24, 2024
2 parents 43dc6e4 + a0ace23 commit 0e32e73
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 5 deletions.
4 changes: 2 additions & 2 deletions commonimages/components/templates/powershell_core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ schemaVersion: 1.0
parameters:
- Version:
type: string
default: 0.3.0
default: 0.4.0
description: Component version (update this each time the file changes)
- Platform:
type: string
default: "Windows"
description: Platform.
- PowerShellCoreVersion:
type: string
default: 7.3.6
default: 7.4.1
description: Version of the PowerShell Core to install
phases:
- name: build
Expand Down
41 changes: 41 additions & 0 deletions commonimages/components/templates/psreadline_fix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
name: psreadline_fix
description: Component to fix PSReadline not rendering shell in things like Fleet Manager sessions on Windows Server 2022
schemaVersion: 1.0
parameters:
- Version:
type: string
default: 0.0.4
description: Component version (update this each time the file changes)
- Platform:
type: string
default: "Windows"
description: Platform.
phases:
- name: build
steps:
- name: RunPSReadLineModuleInstallForceCommand
action: ExecutePowerShell
inputs:
commands:
- |
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Module -Name PSReadLine -Repository PSGallery -MinimumVersion 2.2.2 -Force -AllowClobber -Confirm:$false
# delete old versions of Windows PowerShell PSReadline which are the issue
$psreadlineModuleDirectories = Get-ChildItem -Path "C:\Program Files\WindowsPowerShell\Modules\PSReadline" -Directory
foreach ($psreadlineModuleDirectory in $psreadlineModuleDirectories) {
$moduleDirectoryPath = $psreadlineModuleDirectory.FullName
$moduleDirectoryName = $psreadlineModuleDirectory.Name
if ($moduleDirectoryName -le "2.2.2") {
Remove-Item -Recurse -Force -Path $moduleDirectoryPath
}
}
$PSReadlineVersion = (Get-Module -ListAvailable PSReadLine).Version
Write-Host "PSReadline Module Version: $PSReadlineVersion"
9 changes: 7 additions & 2 deletions teams/hmpps/windows_server_2022/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@ locals {
components_common = [
{
name = "powershell_core"
version = "0.3.0"
version = "0.4.0"
parameters = []
},
{
name = "aws_cli"
version = "0.0.2"
parameters = []
},
{
name = "psreadline_fix"
version = "0.0.4"
parameters = []
}
]

component_template_args = {}
}
}
2 changes: 1 addition & 1 deletion teams/hmpps/windows_server_2022/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
region = "eu-west-2"
ami_name_prefix = "hmpps"
ami_base_name = "windows_server_2022"
configuration_version = "0.0.9"
configuration_version = "0.1.4"
release_or_patch = "release" # or "patch", see nomis AMI image building strategy doc
description = "windows server 2022"

Expand Down

0 comments on commit 0e32e73

Please sign in to comment.