-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DSOS-2601: powershell fixes for win2012 (#556)
* support pwsh 4 * fix * comments * Fix * add user-data script * fix * test * fix * fix * test * test * Fix * fix * fix * fix * Fixes * fix * Readme fix * fix * readme * fix * bump timeout * Fix * fix * more debug * fix
- Loading branch information
1 parent
5749119
commit eb592c2
Showing
9 changed files
with
126 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<# | ||
.SYNOPSIS | ||
Get server-type tag and run associated UserDataScript | ||
#> | ||
|
||
$ErrorActionPreference = "Stop" | ||
$Token = Invoke-RestMethod -TimeoutSec 10 -Headers @{"X-aws-ec2-metadata-token-ttl-seconds"=3600} -Method PUT -Uri http://169.254.169.254/latest/api/token | ||
$InstanceId = Invoke-RestMethod -TimeoutSec 10 -Headers @{"X-aws-ec2-metadata-token" = $Token} -Method GET -Uri http://169.254.169.254/latest/meta-data/instance-id | ||
$TagsRaw = aws ec2 describe-tags --filters "Name=resource-id,Values=$InstanceId" | ||
$Tags = "$TagsRaw" | ConvertFrom-Json | ||
$ServerTypeTag = ($Tags.Tags | Where-Object {$_.Key -eq "server-type"}).Value | ||
$UserDataScript = "${ServerTypeTag}.ps1" | ||
|
||
Set-Location -Path "UserDataScripts" | ||
if (-not $ServerTypeTag) { | ||
Write-Error "Missing or blank server-type tag" | ||
} elseif (-not (Get-ChildItem $UserDataScript -ErrorAction SilentlyContinue)) { | ||
Write-Error "Could not find $UserDataScript" | ||
} else { | ||
. ./$UserDataScript | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
. ../ModPlatformAD/Join-ModPlatformAD.ps1 |