brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [05/13] brooklyn-library git commit: MS SQL improvements
Date Mon, 07 Mar 2016 09:32:35 GMT
MS SQL improvements

- catch possible failures on each step from the install


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-library/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-library/commit/b5ae3421
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-library/tree/b5ae3421
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-library/diff/b5ae3421

Branch: refs/heads/master
Commit: b5ae3421b861130b89fe3c2d5bf82a2f493dac41
Parents: cbb58b9
Author: Valentin Aitken <bostko@gmail.com>
Authored: Wed Mar 2 16:30:08 2016 +0200
Committer: Valentin Aitken <bostko@gmail.com>
Committed: Wed Mar 2 17:36:48 2016 +0200

----------------------------------------------------------------------
 .../entity/database/mssql/installmssql.ps1      | 31 +++++++++++++-------
 1 file changed, 20 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/b5ae3421/software/database/src/main/resources/org/apache/brooklyn/entity/database/mssql/installmssql.ps1
----------------------------------------------------------------------
diff --git a/software/database/src/main/resources/org/apache/brooklyn/entity/database/mssql/installmssql.ps1
b/software/database/src/main/resources/org/apache/brooklyn/entity/database/mssql/installmssql.ps1
index a2ecda0..41bb75c 100644
--- a/software/database/src/main/resources/org/apache/brooklyn/entity/database/mssql/installmssql.ps1
+++ b/software/database/src/main/resources/org/apache/brooklyn/entity/database/mssql/installmssql.ps1
@@ -24,7 +24,21 @@ $Path = "C:\sql2008.iso"
 $Username = "${config['mssql.download.user']}"
 $Password = '${config['mssql.download.password']}'
 
+& winrm set winrm/config/service/auth '@{CredSSP="true"}'
+If ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
+
+& winrm set winrm/config/client/auth '@{CredSSP="true"}'
+If ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
+
+New-Item -ItemType Directory -Force -Path "C:\Program Files (x86)\Microsoft SQL Server\DReplayClient\ResultDir"
+New-Item -ItemType Directory -Force -Path "C:\Program Files (x86)\Microsoft SQL Server\DReplayClient\WorkingDir"
+
+$operationResult = Install-WindowsFeature NET-Framework-Core
+if (-Not $operationResult.Success) { exit 1 }
+
+$pass = '${attribute['windows.password']}'
 
+Try {
 $WebClient = New-Object System.Net.WebClient
 $WebClient.Credentials = New-Object System.Net.Networkcredential($Username, $Password)
 $WebClient.DownloadFile( $url, $path )
@@ -32,15 +46,6 @@ $WebClient.DownloadFile( $url, $path )
 $mountResult = Mount-DiskImage $Path -PassThru
 $driveLetter = (($mountResult | Get-Volume).DriveLetter) + ":\"
 
-New-Item -ItemType Directory -Force -Path "C:\Program Files (x86)\Microsoft SQL Server\DReplayClient\ResultDir"
-New-Item -ItemType Directory -Force -Path "C:\Program Files (x86)\Microsoft SQL Server\DReplayClient\WorkingDir"
-
-Install-WindowsFeature NET-Framework-Core
-
-& winrm set winrm/config/service/auth '@{CredSSP="true"}'
-& winrm set winrm/config/client/auth '@{CredSSP="true"}'
-
-$pass = '${attribute['windows.password']}'
 $secpasswd = ConvertTo-SecureString $pass -AsPlainText -Force
 $mycreds = New-Object System.Management.Automation.PSCredential ($($env:COMPUTERNAME + "\${location.user}"),
$secpasswd)
 
@@ -49,5 +54,9 @@ $exitCode = Invoke-Command -ComputerName $env:COMPUTERNAME -Credential $mycreds
     $process = Start-Process ( $driveLetter + "setup.exe") -ArgumentList "/ConfigurationFile=C:\ConfigurationFile.ini"
-RedirectStandardOutput "C:\sqlout.txt" -RedirectStandardError "C:\sqlerr.txt" -Wait -PassThru
-NoNewWindow
     $process.ExitCode
 } -Authentication CredSSP -ArgumentList $driveLetter
-
-exit $exitCode
+} Catch {
+ Write-Error $_.Exception
+ Write-Host 'Exception logged'
+ exit 1
+}
+exit $exitCode
\ No newline at end of file


Mime
View raw message