Skip to content

Commit

Permalink
fix: avoid running Windows CSE multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
AbelHu committed Mar 13, 2024
1 parent 51a2a4d commit 2e53cc1
Show file tree
Hide file tree
Showing 28 changed files with 71 additions and 43 deletions.
2 changes: 1 addition & 1 deletion parts/windows/csecmd.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ $arguments = '
-CSEResultFilePath %SYSTEMDRIVE%\AzureData\CSEResult.log';
$inputFile = '%SYSTEMDRIVE%\AzureData\CustomData.bin';
$outputFile = '%SYSTEMDRIVE%\AzureData\CustomDataSetupScript.ps1';
if (!(Test-Path $inputFile)) { throw 'ExitCode: |49|, Output: |WINDOWS_CSE_ERROR_NO_CUSTOM_DATA_BIN|, Error: |C:\AzureData\CustomData.bin does not exist.|' };
if (!(Test-Path $inputFile)) { Set-Content -Path '%SYSTEMDRIVE%\AzureData\CSEResult.log' -Value '49' -Force; throw 'ExitCode: |49|, Output: |WINDOWS_CSE_ERROR_NO_CUSTOM_DATA_BIN|, Error: |C:\AzureData\CustomData.bin does not exist.|' };
Copy-Item $inputFile $outputFile;
Invoke-Expression('{0} {1}' -f $outputFile, $arguments);
\"
6 changes: 4 additions & 2 deletions parts/windows/kuberneteswindowssetup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ $global:RebootNeeded = $false

# Extract cse helper script from ZIP
[io.file]::WriteAllBytes("scripts.zip", [System.Convert]::FromBase64String($zippedFiles))
Expand-Archive scripts.zip -DestinationPath "C:\\AzureData\\"
Expand-Archive scripts.zip -DestinationPath "C:\\AzureData\\" -Force

# Dot-source windowscsehelper.ps1 with functions that are called in this script
. c:\AzureData\windows\windowscsehelper.ps1
Expand Down Expand Up @@ -248,7 +248,7 @@ try
Logs-To-Event -TaskName "AKS.WindowsCSE.DownloadAndExpandCSEScriptPackageUrl" -TaskMessage "Start to get CSE scripts. CSEScriptsPackageUrl: $global:CSEScriptsPackageUrl"
$tempfile = 'c:\csescripts.zip'
DownloadFileOverHttp -Url $global:CSEScriptsPackageUrl -DestinationPath $tempfile -ExitCode $global:WINDOWS_CSE_ERROR_DOWNLOAD_CSE_PACKAGE
Expand-Archive $tempfile -DestinationPath "C:\\AzureData\\windows"
Expand-Archive $tempfile -DestinationPath "C:\\AzureData\\windows" -Force
Remove-Item -Path $tempfile -Force

# Dot-source cse scripts with functions that are called in this script
Expand Down Expand Up @@ -488,6 +488,8 @@ finally
# Generate CSE result so it can be returned as the CSE response in csecmd.ps1
$ExecutionDuration=$(New-Timespan -Start $StartTime -End $(Get-Date))
Write-Log "CSE ExecutionDuration: $ExecutionDuration. ExitCode: $global:ExitCode"
# $CSEResultFilePath is used to avoid running CSE multiple times
Set-Content -Path $CSEResultFilePath -Value $global:ExitCode -Force
Logs-To-Event -TaskName "AKS.WindowsCSE.cse_main" -TaskMessage "ExitCode: $global:ExitCode. ErrorMessage: $global:ErrorMessage."
# Please not use Write-Log or Logs-To-Events after Stop-Transcript
Stop-Transcript
Expand Down
2 changes: 1 addition & 1 deletion pkg/agent/testdata/AKSWindows2019+CustomCloud/CSECommand
Original file line number Diff line number Diff line change
@@ -1 +1 @@
powershell.exe -ExecutionPolicy Unrestricted -command " $arguments = ' -MasterIP ''uttestdom-dns-5d7c849e.hcp.southcentralus.azmk8s.io'' -KubeDnsServiceIp ''10.0.0.10'' -MasterFQDNPrefix ''uttestdom'' -Location ''southcentralus'' -TargetEnvironment ''akscustom'' -AgentKey '''' -AADClientId ''ClientID'' -AADClientSecret ''U2VjcmV0'' -NetworkAPIVersion 2018-08-01 -LogFile %SYSTEMDRIVE%\AzureData\CustomDataSetupScript.log -CSEResultFilePath %SYSTEMDRIVE%\AzureData\CSEResult.log'; $inputFile = '%SYSTEMDRIVE%\AzureData\CustomData.bin'; $outputFile = '%SYSTEMDRIVE%\AzureData\CustomDataSetupScript.ps1'; if (!(Test-Path $inputFile)) { throw 'ExitCode: |49|, Output: |WINDOWS_CSE_ERROR_NO_CUSTOM_DATA_BIN|, Error: |C:\AzureData\CustomData.bin does not exist.|' }; Copy-Item $inputFile $outputFile; Invoke-Expression('{0} {1}' -f $outputFile, $arguments); "
powershell.exe -ExecutionPolicy Unrestricted -command " $arguments = ' -MasterIP ''uttestdom-dns-5d7c849e.hcp.southcentralus.azmk8s.io'' -KubeDnsServiceIp ''10.0.0.10'' -MasterFQDNPrefix ''uttestdom'' -Location ''southcentralus'' -TargetEnvironment ''akscustom'' -AgentKey '''' -AADClientId ''ClientID'' -AADClientSecret ''U2VjcmV0'' -NetworkAPIVersion 2018-08-01 -LogFile %SYSTEMDRIVE%\AzureData\CustomDataSetupScript.log -CSEResultFilePath %SYSTEMDRIVE%\AzureData\CSEResult.log'; $inputFile = '%SYSTEMDRIVE%\AzureData\CustomData.bin'; $outputFile = '%SYSTEMDRIVE%\AzureData\CustomDataSetupScript.ps1'; if (!(Test-Path $inputFile)) { Set-Content -Path '%SYSTEMDRIVE%\AzureData\CSEResult.log' -Value '49' -Force; throw 'ExitCode: |49|, Output: |WINDOWS_CSE_ERROR_NO_CUSTOM_DATA_BIN|, Error: |C:\AzureData\CustomData.bin does not exist.|' }; Copy-Item $inputFile $outputFile; Invoke-Expression('{0} {1}' -f $outputFile, $arguments); "
6 changes: 4 additions & 2 deletions pkg/agent/testdata/AKSWindows2019+CustomCloud/CustomData
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ $global:RebootNeeded = $false

# Extract cse helper script from ZIP
[io.file]::WriteAllBytes("scripts.zip", [System.Convert]::FromBase64String($zippedFiles))
Expand-Archive scripts.zip -DestinationPath "C:\\AzureData\\"
Expand-Archive scripts.zip -DestinationPath "C:\\AzureData\\" -Force

# Dot-source windowscsehelper.ps1 with functions that are called in this script
. c:\AzureData\windows\windowscsehelper.ps1
Expand Down Expand Up @@ -244,7 +244,7 @@ try
Logs-To-Event -TaskName "AKS.WindowsCSE.DownloadAndExpandCSEScriptPackageUrl" -TaskMessage "Start to get CSE scripts. CSEScriptsPackageUrl: $global:CSEScriptsPackageUrl"
$tempfile = 'c:\csescripts.zip'
DownloadFileOverHttp -Url $global:CSEScriptsPackageUrl -DestinationPath $tempfile -ExitCode $global:WINDOWS_CSE_ERROR_DOWNLOAD_CSE_PACKAGE
Expand-Archive $tempfile -DestinationPath "C:\\AzureData\\windows"
Expand-Archive $tempfile -DestinationPath "C:\\AzureData\\windows" -Force
Remove-Item -Path $tempfile -Force

# Dot-source cse scripts with functions that are called in this script
Expand Down Expand Up @@ -484,6 +484,8 @@ finally
# Generate CSE result so it can be returned as the CSE response in csecmd.ps1
$ExecutionDuration=$(New-Timespan -Start $StartTime -End $(Get-Date))
Write-Log "CSE ExecutionDuration: $ExecutionDuration. ExitCode: $global:ExitCode"
# $CSEResultFilePath is used to avoid running CSE multiple times
Set-Content -Path $CSEResultFilePath -Value $global:ExitCode -Force
Logs-To-Event -TaskName "AKS.WindowsCSE.cse_main" -TaskMessage "ExitCode: $global:ExitCode. ErrorMessage: $global:ErrorMessage."
# Please not use Write-Log or Logs-To-Events after Stop-Transcript
Stop-Transcript
Expand Down
2 changes: 1 addition & 1 deletion pkg/agent/testdata/AKSWindows2019+CustomVnet/CSECommand
Original file line number Diff line number Diff line change
@@ -1 +1 @@
powershell.exe -ExecutionPolicy Unrestricted -command " $arguments = ' -MasterIP ''uttestdom-dns-5d7c849e.hcp.southcentralus.azmk8s.io'' -KubeDnsServiceIp ''10.0.0.10'' -MasterFQDNPrefix ''uttestdom'' -Location ''southcentralus'' -TargetEnvironment ''AzurePublicCloud'' -AgentKey '''' -AADClientId ''ClientID'' -AADClientSecret ''U2VjcmV0'' -NetworkAPIVersion 2018-08-01 -LogFile %SYSTEMDRIVE%\AzureData\CustomDataSetupScript.log -CSEResultFilePath %SYSTEMDRIVE%\AzureData\CSEResult.log'; $inputFile = '%SYSTEMDRIVE%\AzureData\CustomData.bin'; $outputFile = '%SYSTEMDRIVE%\AzureData\CustomDataSetupScript.ps1'; if (!(Test-Path $inputFile)) { throw 'ExitCode: |49|, Output: |WINDOWS_CSE_ERROR_NO_CUSTOM_DATA_BIN|, Error: |C:\AzureData\CustomData.bin does not exist.|' }; Copy-Item $inputFile $outputFile; Invoke-Expression('{0} {1}' -f $outputFile, $arguments); "
powershell.exe -ExecutionPolicy Unrestricted -command " $arguments = ' -MasterIP ''uttestdom-dns-5d7c849e.hcp.southcentralus.azmk8s.io'' -KubeDnsServiceIp ''10.0.0.10'' -MasterFQDNPrefix ''uttestdom'' -Location ''southcentralus'' -TargetEnvironment ''AzurePublicCloud'' -AgentKey '''' -AADClientId ''ClientID'' -AADClientSecret ''U2VjcmV0'' -NetworkAPIVersion 2018-08-01 -LogFile %SYSTEMDRIVE%\AzureData\CustomDataSetupScript.log -CSEResultFilePath %SYSTEMDRIVE%\AzureData\CSEResult.log'; $inputFile = '%SYSTEMDRIVE%\AzureData\CustomData.bin'; $outputFile = '%SYSTEMDRIVE%\AzureData\CustomDataSetupScript.ps1'; if (!(Test-Path $inputFile)) { Set-Content -Path '%SYSTEMDRIVE%\AzureData\CSEResult.log' -Value '49' -Force; throw 'ExitCode: |49|, Output: |WINDOWS_CSE_ERROR_NO_CUSTOM_DATA_BIN|, Error: |C:\AzureData\CustomData.bin does not exist.|' }; Copy-Item $inputFile $outputFile; Invoke-Expression('{0} {1}' -f $outputFile, $arguments); "
6 changes: 4 additions & 2 deletions pkg/agent/testdata/AKSWindows2019+CustomVnet/CustomData
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ $global:RebootNeeded = $false

# Extract cse helper script from ZIP
[io.file]::WriteAllBytes("scripts.zip", [System.Convert]::FromBase64String($zippedFiles))
Expand-Archive scripts.zip -DestinationPath "C:\\AzureData\\"
Expand-Archive scripts.zip -DestinationPath "C:\\AzureData\\" -Force

# Dot-source windowscsehelper.ps1 with functions that are called in this script
. c:\AzureData\windows\windowscsehelper.ps1
Expand Down Expand Up @@ -244,7 +244,7 @@ try
Logs-To-Event -TaskName "AKS.WindowsCSE.DownloadAndExpandCSEScriptPackageUrl" -TaskMessage "Start to get CSE scripts. CSEScriptsPackageUrl: $global:CSEScriptsPackageUrl"
$tempfile = 'c:\csescripts.zip'
DownloadFileOverHttp -Url $global:CSEScriptsPackageUrl -DestinationPath $tempfile -ExitCode $global:WINDOWS_CSE_ERROR_DOWNLOAD_CSE_PACKAGE
Expand-Archive $tempfile -DestinationPath "C:\\AzureData\\windows"
Expand-Archive $tempfile -DestinationPath "C:\\AzureData\\windows" -Force
Remove-Item -Path $tempfile -Force

# Dot-source cse scripts with functions that are called in this script
Expand Down Expand Up @@ -478,6 +478,8 @@ finally
# Generate CSE result so it can be returned as the CSE response in csecmd.ps1
$ExecutionDuration=$(New-Timespan -Start $StartTime -End $(Get-Date))
Write-Log "CSE ExecutionDuration: $ExecutionDuration. ExitCode: $global:ExitCode"
# $CSEResultFilePath is used to avoid running CSE multiple times
Set-Content -Path $CSEResultFilePath -Value $global:ExitCode -Force
Logs-To-Event -TaskName "AKS.WindowsCSE.cse_main" -TaskMessage "ExitCode: $global:ExitCode. ErrorMessage: $global:ErrorMessage."
# Please not use Write-Log or Logs-To-Events after Stop-Transcript
Stop-Transcript
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
powershell.exe -ExecutionPolicy Unrestricted -command " $arguments = ' -MasterIP ''uttestdom-dns-5d7c849e.hcp.southcentralus.azmk8s.io'' -KubeDnsServiceIp ''10.0.0.10'' -MasterFQDNPrefix ''uttestdom'' -Location ''southcentralus'' -TargetEnvironment ''AzurePublicCloud'' -AgentKey '''' -AADClientId ''ClientID'' -AADClientSecret ''U2VjcmV0'' -NetworkAPIVersion 2018-08-01 -LogFile %SYSTEMDRIVE%\AzureData\CustomDataSetupScript.log -CSEResultFilePath %SYSTEMDRIVE%\AzureData\CSEResult.log'; $inputFile = '%SYSTEMDRIVE%\AzureData\CustomData.bin'; $outputFile = '%SYSTEMDRIVE%\AzureData\CustomDataSetupScript.ps1'; if (!(Test-Path $inputFile)) { throw 'ExitCode: |49|, Output: |WINDOWS_CSE_ERROR_NO_CUSTOM_DATA_BIN|, Error: |C:\AzureData\CustomData.bin does not exist.|' }; Copy-Item $inputFile $outputFile; Invoke-Expression('{0} {1}' -f $outputFile, $arguments); "
powershell.exe -ExecutionPolicy Unrestricted -command " $arguments = ' -MasterIP ''uttestdom-dns-5d7c849e.hcp.southcentralus.azmk8s.io'' -KubeDnsServiceIp ''10.0.0.10'' -MasterFQDNPrefix ''uttestdom'' -Location ''southcentralus'' -TargetEnvironment ''AzurePublicCloud'' -AgentKey '''' -AADClientId ''ClientID'' -AADClientSecret ''U2VjcmV0'' -NetworkAPIVersion 2018-08-01 -LogFile %SYSTEMDRIVE%\AzureData\CustomDataSetupScript.log -CSEResultFilePath %SYSTEMDRIVE%\AzureData\CSEResult.log'; $inputFile = '%SYSTEMDRIVE%\AzureData\CustomData.bin'; $outputFile = '%SYSTEMDRIVE%\AzureData\CustomDataSetupScript.ps1'; if (!(Test-Path $inputFile)) { Set-Content -Path '%SYSTEMDRIVE%\AzureData\CSEResult.log' -Value '49' -Force; throw 'ExitCode: |49|, Output: |WINDOWS_CSE_ERROR_NO_CUSTOM_DATA_BIN|, Error: |C:\AzureData\CustomData.bin does not exist.|' }; Copy-Item $inputFile $outputFile; Invoke-Expression('{0} {1}' -f $outputFile, $arguments); "
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ $global:RebootNeeded = $false

# Extract cse helper script from ZIP
[io.file]::WriteAllBytes("scripts.zip", [System.Convert]::FromBase64String($zippedFiles))
Expand-Archive scripts.zip -DestinationPath "C:\\AzureData\\"
Expand-Archive scripts.zip -DestinationPath "C:\\AzureData\\" -Force

# Dot-source windowscsehelper.ps1 with functions that are called in this script
. c:\AzureData\windows\windowscsehelper.ps1
Expand Down Expand Up @@ -244,7 +244,7 @@ try
Logs-To-Event -TaskName "AKS.WindowsCSE.DownloadAndExpandCSEScriptPackageUrl" -TaskMessage "Start to get CSE scripts. CSEScriptsPackageUrl: $global:CSEScriptsPackageUrl"
$tempfile = 'c:\csescripts.zip'
DownloadFileOverHttp -Url $global:CSEScriptsPackageUrl -DestinationPath $tempfile -ExitCode $global:WINDOWS_CSE_ERROR_DOWNLOAD_CSE_PACKAGE
Expand-Archive $tempfile -DestinationPath "C:\\AzureData\\windows"
Expand-Archive $tempfile -DestinationPath "C:\\AzureData\\windows" -Force
Remove-Item -Path $tempfile -Force

# Dot-source cse scripts with functions that are called in this script
Expand Down Expand Up @@ -478,6 +478,8 @@ finally
# Generate CSE result so it can be returned as the CSE response in csecmd.ps1
$ExecutionDuration=$(New-Timespan -Start $StartTime -End $(Get-Date))
Write-Log "CSE ExecutionDuration: $ExecutionDuration. ExitCode: $global:ExitCode"
# $CSEResultFilePath is used to avoid running CSE multiple times
Set-Content -Path $CSEResultFilePath -Value $global:ExitCode -Force
Logs-To-Event -TaskName "AKS.WindowsCSE.cse_main" -TaskMessage "ExitCode: $global:ExitCode. ErrorMessage: $global:ErrorMessage."
# Please not use Write-Log or Logs-To-Events after Stop-Transcript
Stop-Transcript
Expand Down
2 changes: 1 addition & 1 deletion pkg/agent/testdata/AKSWindows2019+K8S116/CSECommand
Original file line number Diff line number Diff line change
@@ -1 +1 @@
powershell.exe -ExecutionPolicy Unrestricted -command " $arguments = ' -MasterIP ''uttestdom-dns-5d7c849e.hcp.southcentralus.azmk8s.io'' -KubeDnsServiceIp ''10.0.0.10'' -MasterFQDNPrefix ''uttestdom'' -Location ''southcentralus'' -TargetEnvironment ''AzurePublicCloud'' -AgentKey '''' -AADClientId ''ClientID'' -AADClientSecret ''U2VjcmV0'' -NetworkAPIVersion 2018-08-01 -LogFile %SYSTEMDRIVE%\AzureData\CustomDataSetupScript.log -CSEResultFilePath %SYSTEMDRIVE%\AzureData\CSEResult.log'; $inputFile = '%SYSTEMDRIVE%\AzureData\CustomData.bin'; $outputFile = '%SYSTEMDRIVE%\AzureData\CustomDataSetupScript.ps1'; if (!(Test-Path $inputFile)) { throw 'ExitCode: |49|, Output: |WINDOWS_CSE_ERROR_NO_CUSTOM_DATA_BIN|, Error: |C:\AzureData\CustomData.bin does not exist.|' }; Copy-Item $inputFile $outputFile; Invoke-Expression('{0} {1}' -f $outputFile, $arguments); "
powershell.exe -ExecutionPolicy Unrestricted -command " $arguments = ' -MasterIP ''uttestdom-dns-5d7c849e.hcp.southcentralus.azmk8s.io'' -KubeDnsServiceIp ''10.0.0.10'' -MasterFQDNPrefix ''uttestdom'' -Location ''southcentralus'' -TargetEnvironment ''AzurePublicCloud'' -AgentKey '''' -AADClientId ''ClientID'' -AADClientSecret ''U2VjcmV0'' -NetworkAPIVersion 2018-08-01 -LogFile %SYSTEMDRIVE%\AzureData\CustomDataSetupScript.log -CSEResultFilePath %SYSTEMDRIVE%\AzureData\CSEResult.log'; $inputFile = '%SYSTEMDRIVE%\AzureData\CustomData.bin'; $outputFile = '%SYSTEMDRIVE%\AzureData\CustomDataSetupScript.ps1'; if (!(Test-Path $inputFile)) { Set-Content -Path '%SYSTEMDRIVE%\AzureData\CSEResult.log' -Value '49' -Force; throw 'ExitCode: |49|, Output: |WINDOWS_CSE_ERROR_NO_CUSTOM_DATA_BIN|, Error: |C:\AzureData\CustomData.bin does not exist.|' }; Copy-Item $inputFile $outputFile; Invoke-Expression('{0} {1}' -f $outputFile, $arguments); "
6 changes: 4 additions & 2 deletions pkg/agent/testdata/AKSWindows2019+K8S116/CustomData
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ $global:RebootNeeded = $false

# Extract cse helper script from ZIP
[io.file]::WriteAllBytes("scripts.zip", [System.Convert]::FromBase64String($zippedFiles))
Expand-Archive scripts.zip -DestinationPath "C:\\AzureData\\"
Expand-Archive scripts.zip -DestinationPath "C:\\AzureData\\" -Force

# Dot-source windowscsehelper.ps1 with functions that are called in this script
. c:\AzureData\windows\windowscsehelper.ps1
Expand Down Expand Up @@ -244,7 +244,7 @@ try
Logs-To-Event -TaskName "AKS.WindowsCSE.DownloadAndExpandCSEScriptPackageUrl" -TaskMessage "Start to get CSE scripts. CSEScriptsPackageUrl: $global:CSEScriptsPackageUrl"
$tempfile = 'c:\csescripts.zip'
DownloadFileOverHttp -Url $global:CSEScriptsPackageUrl -DestinationPath $tempfile -ExitCode $global:WINDOWS_CSE_ERROR_DOWNLOAD_CSE_PACKAGE
Expand-Archive $tempfile -DestinationPath "C:\\AzureData\\windows"
Expand-Archive $tempfile -DestinationPath "C:\\AzureData\\windows" -Force
Remove-Item -Path $tempfile -Force

# Dot-source cse scripts with functions that are called in this script
Expand Down Expand Up @@ -478,6 +478,8 @@ finally
# Generate CSE result so it can be returned as the CSE response in csecmd.ps1
$ExecutionDuration=$(New-Timespan -Start $StartTime -End $(Get-Date))
Write-Log "CSE ExecutionDuration: $ExecutionDuration. ExitCode: $global:ExitCode"
# $CSEResultFilePath is used to avoid running CSE multiple times
Set-Content -Path $CSEResultFilePath -Value $global:ExitCode -Force
Logs-To-Event -TaskName "AKS.WindowsCSE.cse_main" -TaskMessage "ExitCode: $global:ExitCode. ErrorMessage: $global:ErrorMessage."
# Please not use Write-Log or Logs-To-Events after Stop-Transcript
Stop-Transcript
Expand Down
2 changes: 1 addition & 1 deletion pkg/agent/testdata/AKSWindows2019+K8S117/CSECommand
Original file line number Diff line number Diff line change
@@ -1 +1 @@
powershell.exe -ExecutionPolicy Unrestricted -command " $arguments = ' -MasterIP ''uttestdom-dns-5d7c849e.hcp.southcentralus.azmk8s.io'' -KubeDnsServiceIp ''10.0.0.10'' -MasterFQDNPrefix ''uttestdom'' -Location ''southcentralus'' -TargetEnvironment ''AzurePublicCloud'' -AgentKey '''' -AADClientId ''ClientID'' -AADClientSecret ''U2VjcmV0'' -NetworkAPIVersion 2018-08-01 -LogFile %SYSTEMDRIVE%\AzureData\CustomDataSetupScript.log -CSEResultFilePath %SYSTEMDRIVE%\AzureData\CSEResult.log'; $inputFile = '%SYSTEMDRIVE%\AzureData\CustomData.bin'; $outputFile = '%SYSTEMDRIVE%\AzureData\CustomDataSetupScript.ps1'; if (!(Test-Path $inputFile)) { throw 'ExitCode: |49|, Output: |WINDOWS_CSE_ERROR_NO_CUSTOM_DATA_BIN|, Error: |C:\AzureData\CustomData.bin does not exist.|' }; Copy-Item $inputFile $outputFile; Invoke-Expression('{0} {1}' -f $outputFile, $arguments); "
powershell.exe -ExecutionPolicy Unrestricted -command " $arguments = ' -MasterIP ''uttestdom-dns-5d7c849e.hcp.southcentralus.azmk8s.io'' -KubeDnsServiceIp ''10.0.0.10'' -MasterFQDNPrefix ''uttestdom'' -Location ''southcentralus'' -TargetEnvironment ''AzurePublicCloud'' -AgentKey '''' -AADClientId ''ClientID'' -AADClientSecret ''U2VjcmV0'' -NetworkAPIVersion 2018-08-01 -LogFile %SYSTEMDRIVE%\AzureData\CustomDataSetupScript.log -CSEResultFilePath %SYSTEMDRIVE%\AzureData\CSEResult.log'; $inputFile = '%SYSTEMDRIVE%\AzureData\CustomData.bin'; $outputFile = '%SYSTEMDRIVE%\AzureData\CustomDataSetupScript.ps1'; if (!(Test-Path $inputFile)) { Set-Content -Path '%SYSTEMDRIVE%\AzureData\CSEResult.log' -Value '49' -Force; throw 'ExitCode: |49|, Output: |WINDOWS_CSE_ERROR_NO_CUSTOM_DATA_BIN|, Error: |C:\AzureData\CustomData.bin does not exist.|' }; Copy-Item $inputFile $outputFile; Invoke-Expression('{0} {1}' -f $outputFile, $arguments); "
Loading

0 comments on commit 2e53cc1

Please sign in to comment.