Repository: ambari Updated Branches: refs/heads/trunk 08e726ada -> ccc6acdf9
AMBARI-5550 - Create MSI for Ambari-SCOM 2.0.0.0 (Ivan Malamen via tbeerbower) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ccc6acdf Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ccc6acdf Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ccc6acdf Branch: refs/heads/trunk Commit: ccc6acdf94f82bc50f9f8df62e41a05dfc9c9019 Parents: 08e726a Author: tbeerbower <[email protected]> Authored: Mon Apr 28 15:09:29 2014 -0400 Committer: tbeerbower <[email protected]> Committed: Mon Apr 28 15:09:29 2014 -0400 ---------------------------------------------------------------------- .../ambari-winpkg/scripts/install.ps1 | 58 ++++++++++++-------- .../ambari-winpkg/scripts/uninstall.ps1 | 31 +++++++---- .../msi/src/AmbariSetupTools/winpkg.ps1 | 18 +++++- .../msi/src/GUI_Ambari/Form1.Designer.cs | 17 +++++- contrib/ambari-scom/msi/src/GUI_Ambari/Form1.cs | 37 +++++++------ .../ambari-scom/msi/src/GUI_Ambari/Form1.resx | 4 +- .../ambari-scom/msi/src/GUI_Ambari/Program.cs | 38 ++++++++++++- contrib/ambari-scom/msi/src/ambari-scom.wxs | 21 +++++-- 8 files changed, 161 insertions(+), 63 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/ccc6acdf/contrib/ambari-scom/msi/src/AmbariPackages/ambari-winpkg/scripts/install.ps1 ---------------------------------------------------------------------- diff --git a/contrib/ambari-scom/msi/src/AmbariPackages/ambari-winpkg/scripts/install.ps1 b/contrib/ambari-scom/msi/src/AmbariPackages/ambari-winpkg/scripts/install.ps1 index a762373..5e114a6 100644 --- a/contrib/ambari-scom/msi/src/AmbariPackages/ambari-winpkg/scripts/install.ps1 +++ b/contrib/ambari-scom/msi/src/AmbariPackages/ambari-winpkg/scripts/install.ps1 @@ -120,7 +120,7 @@ function PushInstall-Files( $node,$source_path,$target_path) } function Main( $scriptDir ) { - Write-Log "INSTALLATION started" + Write-Log "INSTALLATION of 2.0.0 started" Write-Log "Reading Ambari layout from $ENV:AMB_LAYOUT" if ( -not (Test-Path $ENV:AMB_LAYOUT)) { @@ -170,12 +170,15 @@ function Main( $scriptDir ) $SQL_SERVER_LOGIN = $env:SQL_SERVER_LOGIN $SQL_SERVER_PASSWORD= $env:SQL_SERVER_PASSWORD $START_SERVICES = $ENV:START_SERVICES + $RECREATE_DB = $ENV:RECREATE_DB Write-log "Start services flag is $START_SERVICES" - $hosts= @($SQL_SERVER_NAME,$ENV:NAMENODE_HOST,$ENV:SECONDARY_NAMENODE_HOST,$ENV:JOBTRACKER_HOST,$ENV:HIVE_SERVER_HOST,$ENV:OOZIE_SERVER_HOST, + Write-log "Recreate DB flag is $RECREATE_DB" + $hosts= @($SQL_SERVER_NAME,$ENV:NAMENODE_HOST,$ENV:SECONDARY_NAMENODE_HOST,$ENV:RESOURCEMANAGER_HOST,$ENV:HIVE_SERVER_HOST,$ENV:OOZIE_SERVER_HOST, $ENV:WEBHCAT_HOST,$ENV:HBASE_MASTER) Split_Hosts $ENV:SLAVE_HOSTS ([REF]$hosts) Split_Hosts $ENV:ZOOKEEPER_HOSTS ([REF]$hosts) Split_Hosts $ENV:FLUME_HOSTS ([REF]$hosts) + Split_Hosts $ENV:CLIENT_HOSTS ([REF]$hosts) Write-Log "Hosts list:" Write-log $hosts Write-Log "Intalling data sink on each host" @@ -187,8 +190,9 @@ function Main( $scriptDir ) PushInstall-Files $server $destination $destination Write-Log "Executing data sink installation" $out = Invoke-Command -ComputerName $server -ScriptBlock { - param( $server,$SQL_SERVER_NAME,$SQL_SERVER_PORT,$SQL_SERVER_LOGIN,$SQL_SERVER_PASSWORD,$destination,$ambari_metrics,$START_SERVICES ) + param( $server,$SQL_SERVER_NAME,$SQL_SERVER_PORT,$SQL_SERVER_LOGIN,$SQL_SERVER_PASSWORD,$destination,$ambari_metrics,$START_SERVICES,$RECREATE_DB ) $log = Join-Path $destination "ambari_install.log" + Out-File -FilePath $log -InputObject "Starting installation" -Append -Encoding "UTF8" function Invoke-Cmd ($command) { Out-File -FilePath $log -InputObject "$command" -Append -Encoding "UTF8" @@ -229,19 +233,24 @@ function Main( $scriptDir ) $value = "$name.sink.sql.databaseUrl=jdbc:sqlserver://$SQL_SERVER_NAME':$SQL_SERVER_PORT;databaseName=HadoopMetrics;user=$SQL_SERVER_LOGIN;password=$SQL_SERVER_PASSWORD" Add-Content $metrics $value.Replace("'","") } + Out-File -FilePath $log -InputObject "Recreate db is $RECREATE_DB" -Append -Encoding "UTF8" if ($server -ieq $SQL_SERVER_NAME) { - Out-File -FilePath $log -InputObject "Creating MonitoringDatabase environment" -Append -Encoding "UTF8" - Write-HOST "Creating MonitoringDatabase environment" - Write-Output "Creating MonitoringDatabase environment" - $sql_path = Join-Path $destination "\Hadoop-Metrics-SQLServer-CREATE.ddl" - $cmd ="sqlcmd -s $SQL_SERVER_NAME -i $sql_path -U $SQL_SERVER_LOGIN -P $SQL_SERVER_PASSWORD" - $check = invoke-cmd $cmd - if ($check -like "*failed*") - { - Write-Output "Cannot create database" - Out-File -FilePath $log -InputObject "Cannot create database" -Append -Encoding "UTF8" - } + Out-File -FilePath $log -InputObject "$server is DB" -Append -Encoding "UTF8" + if ($RECREATE_DB -like "*yes*") + { + Out-File -FilePath $log -InputObject "Creating MonitoringDatabase environment" -Append -Encoding "UTF8" + Write-HOST "Creating MonitoringDatabase environment" + Write-Output "Creating MonitoringDatabase environment" + $sql_path = Join-Path $destination "\Hadoop-Metrics-SQLServer-CREATE.ddl" + $cmd ="sqlcmd -s $SQL_SERVER_NAME -i $sql_path -U $SQL_SERVER_LOGIN -P $SQL_SERVER_PASSWORD" + $check = invoke-cmd $cmd + if ($check -like "*failed*") + { + Write-Output "Cannot create database" + Out-File -FilePath $log -InputObject "Cannot create database" -Append -Encoding "UTF8" + } + } } $hdp_home = [Environment]::GetEnvironmentVariable("HADOOP_HOME","Machine") if ($hdp_home -ne $null) @@ -249,13 +258,13 @@ function Main( $scriptDir ) Out-File -FilePath $log -InputObject "Installing data sink on $server" -Append -Encoding "UTF8" Write-Host "Installing data sink on $server" Write-Output "Installing data sink on $server" - $metrics = Join-Path $hdp_home "bin\hadoop-metrics2.properties" + $metrics = Join-Path $hdp_home "etc\hadoop\hadoop-metrics2.properties" if (-not (test-path $metrics)) { $metrics = Join-Path $hdp_home "conf\hadoop-metrics2.properties" } - Add-Content $metrics "*.sink.sql.class=org.apache.hadoop.metrics2.sink.SqlServerSink" - $names = @("namenode","datanode","jobtracker","tasktracker","maptask","reducetask") + Add-Content $metrics "*.sink.sql.class=org.apache.hadoop.metrics2.sink.SqlServerSinkHadoop2" + $names = @("namenode","secondarynamenode","datanode","resourcemanager","nodemanager","maptask","mrappmaster","reducetask") foreach ($name in $names) { modify_value $name @@ -263,7 +272,7 @@ function Main( $scriptDir ) Out-File -FilePath $log -InputObject "Modifying CLASSPATH" -Append -Encoding "UTF8" Write-Host "Modifying CLASSPATH" Write-Output "Modifying CLASSPATH" - $names = @("namenode","secondarynamenode","datanode","historyserver","jobtracker","tasktracker") + $names = @("namenode","secondarynamenode","datanode","historyserver","resourcemanager","nodemanager") foreach ($name in $names) { modify_xml $name @@ -289,7 +298,7 @@ function Main( $scriptDir ) Copy-Item $log $log_new Remove-Item $Destination -force -Recurse } - } -ArgumentList ($server,$SQL_SERVER_NAME,$SQL_SERVER_PORT,$SQL_SERVER_LOGIN,$SQL_SERVER_PASSWORD,$destination,$ambari_metrics,$START_SERVICES) + } -ArgumentList ($server,$SQL_SERVER_NAME,$SQL_SERVER_PORT,$SQL_SERVER_LOGIN,$SQL_SERVER_PASSWORD,$destination,$ambari_metrics,$START_SERVICES,$RECREATE_DB) if ($out -like "*Cannot create database*") { Write-Log "DB creation on $server failed." @@ -331,12 +340,10 @@ function Main( $scriptDir ) $clp = $ENV:HDP_LAYOUT $destination_conf = Join-Path $destination "$ambari_conf\conf\clusterproperties.txt" Copy-Item -Force $clp $destination_conf - $destination = Join-Path $destination "clusterproperties.txt" - Copy-Item -Force $clp $destination Write-Log "Creating shortcut to start Ambari" $objShell = New-Object -ComObject ("WScript.Shell") $objShortCut = $objShell.CreateShortcut($env:USERPROFILE + "\Desktop" + "\Start Ambari SCOM Server.lnk") - $classpath = "$env:AMB_DATA_DIR\$ambari_conf\conf\;$env:AMB_DATA_DIR\sqljdbc4.jar;$env:AMB_DATA_DIR\$ambari_scom;$env:AMB_DATA_DIR\$ambari_lib\lib\*" + $classpath = "$env:AMB_DATA_DIR\$ambari_conf\conf\;$env:AMB_DATA_DIR\sqljdbc4.jar;$env:AMB_DATA_DIR\$ambari_scom;$env:AMB_DATA_DIR\$ambari_lib\lib\*;$env:HADOOP_HOME\etc\hadoop" $targetpath = "$ENV:JAVA_HOME\bin\java" $arguments = "-server -XX:NewRatio=3 -XX:+UseConcMarkSweepGC -XX:-UseGCOverheadLimit -XX:CMSInitiatingOccupancyFraction=60 -cp $classpath org.apache.ambari.scom.AmbariServer" $objShortCut.TargetPath = $targetpath @@ -347,8 +354,11 @@ function Main( $scriptDir ) CreateUrl "http://$ENV:COMPUTERNAME':8080/api/v1/clusters/ambari/services/HDFS/components/NAMENODE" "Browse Ambari Metrics.url" Write-Log "Copying ambari properties file" Copy-Item $ENV:AMB_LAYOUT "$env:AMB_DATA_DIR\ambariproperties.txt" - [Environment]::SetEnvironmentVariable("HDP_LAYOUT","","Machine") - [Environment]::SetEnvironmentVariable("START_SERVICES","","Machine") + $vars = @("HDP_LAYOUT","START_SERVICES","RECREATE_DB") + foreach ($var in $vars) + { + [Environment]::SetEnvironmentVariable($var,$null,"Machine") + } Write-Log "INSTALLATION COMPLETE" http://git-wip-us.apache.org/repos/asf/ambari/blob/ccc6acdf/contrib/ambari-scom/msi/src/AmbariPackages/ambari-winpkg/scripts/uninstall.ps1 ---------------------------------------------------------------------- diff --git a/contrib/ambari-scom/msi/src/AmbariPackages/ambari-winpkg/scripts/uninstall.ps1 b/contrib/ambari-scom/msi/src/AmbariPackages/ambari-winpkg/scripts/uninstall.ps1 index c3f3546..91b3bdc 100644 --- a/contrib/ambari-scom/msi/src/AmbariPackages/ambari-winpkg/scripts/uninstall.ps1 +++ b/contrib/ambari-scom/msi/src/AmbariPackages/ambari-winpkg/scripts/uninstall.ps1 @@ -44,7 +44,7 @@ function GetName($name,$param) } function Main( $scriptDir ) { - Write-Log "UNINSTALLATION STARTED" + Write-Log "UNINSTALLATION of 2.0.0 STARTED" Write-Log "Reading Ambari and HDP layout" $destination= [Environment]::GetEnvironmentVariable("AMB_DATA_DIR","Machine") if (-not (Test-Path ENV:AMB_LAYOUT)) @@ -53,21 +53,25 @@ function Main( $scriptDir ) } if (-not (Test-Path ENV:HDP_LAYOUT) -or ($ENV:HDP_LAYOUT -notlike "*:")) { - $ENV:HDP_LAYOUT = Join-Path $destination "clusterproperties.txt" + $hdp = Join-Path $destination "\ambari-scom-server-*-conf" + $hdp = Getname $hdp "full" + $ENV:HDP_LAYOUT = Join-Path $hdp "conf\clusterproperties.txt" } Write-Log "Ambari layout = $ENV:AMB_LAYOUT" Write-Log "Cluster layout = $ENV:HDP_LAYOUT" Export-ClusterLayoutIntoEnv $ENV:AMB_LAYOUT "amb" Export-ClusterLayoutIntoEnv $ENV:HDP_LAYOUT "hdp" $jar = Join-Path $destination "\metrics-sink-*.jar" - $ambari_metrics = Getname $jar "short" + $ambari_metrics = Getname $jar "short" + Write-Log "Metrics sink is $ambari_metrics" $current = @() $SQL_SERVER_NAME = $env:SQL_SERVER_NAME - $hosts= @($SQL_SERVER_NAME,$ENV:NAMENODE_HOST,$ENV:SECONDARY_NAMENODE_HOST,$ENV:JOBTRACKER_HOST,$ENV:HIVE_SERVER_HOST,$ENV:OOZIE_SERVER_HOST, + $hosts= @($SQL_SERVER_NAME,$ENV:NAMENODE_HOST,$ENV:SECONDARY_NAMENODE_HOST,$ENV:RESOURCEMANAGER_HOST,$ENV:HIVE_SERVER_HOST,$ENV:OOZIE_SERVER_HOST, $ENV:WEBHCAT_HOST,$ENV:HBASE_MASTER) Split_Hosts $ENV:SLAVE_HOSTS ([REF]$hosts) Split_Hosts $ENV:ZOOKEEPER_HOSTS ([REF]$hosts) Split_Hosts $ENV:FLUME_HOSTS ([REF]$hosts) + Split_Hosts $ENV:CLIENT_HOSTS ([REF]$hosts) Write-Log "Hosts list:" Write-log $hosts Write-Log "Uninstalling from each host" @@ -108,7 +112,7 @@ function Main( $scriptDir ) Write-Output "Succeeded" } Out-File -FilePath $log -InputObject "Cleaning up metrics" -Append -Encoding "UTF8" - $metrics = Join-Path $hdp_home "bin\hadoop-metrics2.properties" + $metrics = Join-Path $hdp_home "etc\hadoop\hadoop-metrics2.properties" if (-not (test-path $metrics)) { $metrics = Join-Path $hdp_home "conf\hadoop-metrics2.properties" @@ -124,11 +128,12 @@ function Main( $scriptDir ) } Set-Content -Path $metrics -Value $result Out-File -FilePath $log -InputObject "Cleaning up xml's" -Append -Encoding "UTF8" - $names = @("namenode","secondarynamenode","datanode","historyserver","jobtracker","tasktracker") + $names = @("namenode","secondarynamenode","datanode","historyserver","resourcemanager","nodemanager") foreach ($name in $names) { $xml_file= Join-Path $hdp_home "bin\$name.xml" Out-File -FilePath $log -InputObject "Cleaning up $xml_file" -Append -Encoding "UTF8" + Out-File -FilePath $log -InputObject "Removing ;$destination\$ambari_metrics;$destination\sqljdbc4.jar" -Append -Encoding "UTF8" (Get-Content $xml_file)|ForEach-Object { $_.Replace(";$destination\$ambari_metrics;$destination\sqljdbc4.jar","") }|Set-Content $xml_file @@ -181,10 +186,16 @@ function Main( $scriptDir ) Write-Log "Removing Ambari folder" Remove-Item $destination -force -Recurse Write-Log "Removing shortcut" - Remove-Item "$env:USERPROFILE\Desktop\Start Ambari SCOM Server.lnk" -Force - Remove-Item "$env:USERPROFILE\Desktop\Browse Ambari API.url" -Force - Remove-Item "$env:USERPROFILE\Desktop\Browse Ambari Metrics.url" -Force - [Environment]::SetEnvironmentVariable("AMB_DATA_DIR", "", "Machine") + $shortcuts = @("$env:USERPROFILE\Desktop\Start Ambari SCOM Server.lnk","$env:USERPROFILE\Desktop\Browse Ambari API.url","$env:USERPROFILE\Desktop\Browse Ambari Metrics.url") + foreach ($shortcut in $shortcuts) + { + Remove-Item $shortcut -Force + } + $vars = @("HDP_LAYOUT","START_SERVICES","RECREATE_DB","AMB_DATA_DIR") + foreach ($var in $vars) + { + [Environment]::SetEnvironmentVariable($var,$null,"Machine") + } Write-Log "UNINSTALLATION COMPLETE " } http://git-wip-us.apache.org/repos/asf/ambari/blob/ccc6acdf/contrib/ambari-scom/msi/src/AmbariSetupTools/winpkg.ps1 ---------------------------------------------------------------------- diff --git a/contrib/ambari-scom/msi/src/AmbariSetupTools/winpkg.ps1 b/contrib/ambari-scom/msi/src/AmbariSetupTools/winpkg.ps1 index d24e8b0..c06764f 100644 --- a/contrib/ambari-scom/msi/src/AmbariSetupTools/winpkg.ps1 +++ b/contrib/ambari-scom/msi/src/AmbariSetupTools/winpkg.ps1 @@ -510,11 +510,27 @@ function Main( $winpkgBinPath, $Package, $Action ) } } $start_services = [Environment]::GetEnvironmentVariable("START_SERVICES","Machine") - if ($start_services -like "*yes*") + if ($start_services -eq "yes") { Write-LOG "Start services flag is $start_services" $env:start_services = $start_services } + elseif ($start_services -ne $null) + { + Write-LOG "Start services flag is $start_services" + $env:start_services = $start_services + } + $recreate_db = [Environment]::GetEnvironmentVariable("RECREATE_DB","Machine") + if ($recreate_db -eq "yes") + { + Write-LOG "Recreate DB flag is $recreate_db" + $env:recreate_db = $recreate_db + } + elseif ($recreate_db -ne $null) + { + Write-LOG "Recreate DB flag is $recreate_db" + $env:recreate_db = $recreate_db + } Write-LOG "User is $ENV:USERNAME" Write-Log "Cluster properties path: $ENV:HDP_LAYOUT" Write-Log "Current Directory: $pwd" http://git-wip-us.apache.org/repos/asf/ambari/blob/ccc6acdf/contrib/ambari-scom/msi/src/GUI_Ambari/Form1.Designer.cs ---------------------------------------------------------------------- diff --git a/contrib/ambari-scom/msi/src/GUI_Ambari/Form1.Designer.cs b/contrib/ambari-scom/msi/src/GUI_Ambari/Form1.Designer.cs index 8931261..1ab6c4e 100644 --- a/contrib/ambari-scom/msi/src/GUI_Ambari/Form1.Designer.cs +++ b/contrib/ambari-scom/msi/src/GUI_Ambari/Form1.Designer.cs @@ -64,6 +64,7 @@ namespace GUI_Ambari this.SQLDbrowse = new System.Windows.Forms.Button(); this.SQLDpath = new System.Windows.Forms.TextBox(); this.Cstart = new System.Windows.Forms.CheckBox(); + this.DBdel = new System.Windows.Forms.CheckBox(); this.SuspendLayout(); // // Install @@ -272,14 +273,27 @@ namespace GUI_Ambari this.Cstart.Text = "Start Services"; this.Cstart.UseVisualStyleBackColor = true; // + // DBdel + // + this.DBdel.AutoSize = true; + this.DBdel.Checked = true; + this.DBdel.CheckState = System.Windows.Forms.CheckState.Checked; + this.DBdel.Location = new System.Drawing.Point(295, 65); + this.DBdel.Name = "DBdel"; + this.DBdel.Size = new System.Drawing.Size(88, 17); + this.DBdel.TabIndex = 22; + this.DBdel.Text = "Recreate DB"; + this.DBdel.UseVisualStyleBackColor = true; + // // Form1 // this.AcceptButton = this.Install; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.Cancel; - this.ClientSize = new System.Drawing.Size(375, 308); + this.ClientSize = new System.Drawing.Size(381, 308); this.ControlBox = false; + this.Controls.Add(this.DBdel); this.Controls.Add(this.Cstart); this.Controls.Add(this.label6); this.Controls.Add(this.SQLDbrowse); @@ -342,6 +356,7 @@ namespace GUI_Ambari private System.Windows.Forms.Button SQLDbrowse; private System.Windows.Forms.TextBox SQLDpath; private System.Windows.Forms.CheckBox Cstart; + private System.Windows.Forms.CheckBox DBdel; } } http://git-wip-us.apache.org/repos/asf/ambari/blob/ccc6acdf/contrib/ambari-scom/msi/src/GUI_Ambari/Form1.cs ---------------------------------------------------------------------- diff --git a/contrib/ambari-scom/msi/src/GUI_Ambari/Form1.cs b/contrib/ambari-scom/msi/src/GUI_Ambari/Form1.cs index 63cfe05..3fd2d7b 100644 --- a/contrib/ambari-scom/msi/src/GUI_Ambari/Form1.cs +++ b/contrib/ambari-scom/msi/src/GUI_Ambari/Form1.cs @@ -28,10 +28,15 @@ namespace GUI_Ambari { public partial class Form1 : Form { - public Form1() + public Form1(string upgrade) { InitializeComponent(); + if (!string.IsNullOrEmpty(upgrade)) + { + DBdel.Checked = false; + Install.Text = "Upgrade"; + } } @@ -123,25 +128,11 @@ namespace GUI_Ambari DialogResult result = MessageBox.Show("Do you really want to exit?", "Warning", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { - Kill_Msiexec(); + GUI_Ambari.Program.Kill_Msiexec(); Environment.Exit(1); } } - private void Kill_Msiexec() - { - try - { - var processes = Process.GetProcessesByName("msiexec").OrderBy(x => x.StartTime); - foreach (var process in processes) - { - process.Kill(); - } - } - catch - { - } - } private void Reset_Click(object sender, EventArgs e) { AID.Text = "C:\\Ambari"; @@ -153,6 +144,7 @@ namespace GUI_Ambari Cpath.Clear(); SQLDpath.Clear(); Cstart.Checked = false; + DBdel.Checked = true; CLP_Path(); } @@ -194,7 +186,18 @@ namespace GUI_Ambari { Environment.SetEnvironmentVariable("START_SERVICES", "yes", EnvironmentVariableTarget.Machine); } - + else + { + Environment.SetEnvironmentVariable("START_SERVICES", "no", EnvironmentVariableTarget.Machine); + } + if (DBdel.Checked == true) + { + Environment.SetEnvironmentVariable("RECREATE_DB", "yes", EnvironmentVariableTarget.Machine); + } + else + { + Environment.SetEnvironmentVariable("RECREATE_DB", "no", EnvironmentVariableTarget.Machine); + } } Environment.SetEnvironmentVariable("HDP_LAYOUT", Cpath.Text, EnvironmentVariableTarget.Machine); Environment.Exit(0); http://git-wip-us.apache.org/repos/asf/ambari/blob/ccc6acdf/contrib/ambari-scom/msi/src/GUI_Ambari/Form1.resx ---------------------------------------------------------------------- diff --git a/contrib/ambari-scom/msi/src/GUI_Ambari/Form1.resx b/contrib/ambari-scom/msi/src/GUI_Ambari/Form1.resx index 00183e6..d634957 100644 --- a/contrib/ambari-scom/msi/src/GUI_Ambari/Form1.resx +++ b/contrib/ambari-scom/msi/src/GUI_Ambari/Form1.resx @@ -11,8 +11,6 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> - -<!-- test --> <root> <!-- Microsoft ResX Schema @@ -137,4 +135,4 @@ limitations under the License. --> <metadata name="OpenFile.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>129, 17</value> </metadata> -</root> +</root> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/ccc6acdf/contrib/ambari-scom/msi/src/GUI_Ambari/Program.cs ---------------------------------------------------------------------- diff --git a/contrib/ambari-scom/msi/src/GUI_Ambari/Program.cs b/contrib/ambari-scom/msi/src/GUI_Ambari/Program.cs index 1884459..5250d35 100644 --- a/contrib/ambari-scom/msi/src/GUI_Ambari/Program.cs +++ b/contrib/ambari-scom/msi/src/GUI_Ambari/Program.cs @@ -17,6 +17,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; +using System.Diagnostics; namespace GUI_Ambari { @@ -27,12 +28,30 @@ namespace GUI_Ambari static void Main(string[] args) { string mode = args[0]; + string upgrade = null; + try + { + upgrade = args[1]; + } + catch { } switch (mode) - { + { + case "upgrade": + if (!String.IsNullOrEmpty(upgrade)) + { + DialogResult upgrade_dial = MessageBox.Show("Old version of Ambari-SCOM detected. Do you want to perform upgrade?", "Ambari-SCOM Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); + if (upgrade_dial == DialogResult.No) + { + Kill_Msiexec(); + Environment.Exit(0); + } + } + + break; case "gui": Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new Form1()); + Application.Run(new Form1(upgrade)); break; case "install": string file_inst = Environment.GetEnvironmentVariable("tmp") + @"\ambari_failed.txt"; @@ -77,5 +96,20 @@ namespace GUI_Ambari } } + + public static void Kill_Msiexec() + { + try + { + var processes = Process.GetProcessesByName("msiexec").OrderBy(x => x.StartTime); + foreach (var process in processes) + { + process.Kill(); + } + } + catch + { + } + } } } http://git-wip-us.apache.org/repos/asf/ambari/blob/ccc6acdf/contrib/ambari-scom/msi/src/ambari-scom.wxs ---------------------------------------------------------------------- diff --git a/contrib/ambari-scom/msi/src/ambari-scom.wxs b/contrib/ambari-scom/msi/src/ambari-scom.wxs index 0c50d24..4d7ddb8 100644 --- a/contrib/ambari-scom/msi/src/ambari-scom.wxs +++ b/contrib/ambari-scom/msi/src/ambari-scom.wxs @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. --> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> - <Product Id="{C627953F-1C50-4520-AB91-A938F7E01B58}" Codepage="1252" Language="1033" Manufacturer="Apache" Name="Ambari-SCOM" UpgradeCode="{CD3CAC20-F0A9-4EF7-9C75-CF660D0697AA}" Version="1.3.0.0"> + <Product Id="{C627953F-1C50-4520-AB91-A938F7E01200}" Codepage="1252" Language="1033" Manufacturer="Apache" Name="Ambari-SCOM" UpgradeCode="{CD3CAC20-F0A9-4EF7-9C75-CF660D0697AA}" Version="2.0.0.0"> <Package Comments="This installer database contains the logic and data required to install Apache Ambari-SCOM." Compressed="yes" Description="Ambari-SCOM" InstallerVersion="100" Languages="1033" Manufacturer="Apache" Platform="x86" /> <Binary Id="GUI" SourceFile="SourceDir\bin\GUI_Ambari.exe" /> <Condition Message="You need to be an administrator to install this product.">Privileged</Condition> @@ -21,7 +21,8 @@ limitations under the License. --> <CustomAction Id="INSTSUCCESS" Error="Installation completed succesfully" /> <CustomAction Id="INSTFAILED" Error="Installation failed. Please see installation log for details: [TARGETDIR]AmbariInstallFiles\AmbariSetupTools\ambari.winpkg.install.log" /> <CustomAction Id="SET_AMB_LAYOUT" Property="AMB_LAYOUT" Value="[%APPDATA]\amb_install\ambariproperties.txt" /> - <CustomAction Id="GUI" BinaryKey="GUI" ExeCommand="gui" /> + <CustomAction Id="Upgrade" BinaryKey="GUI" ExeCommand="upgrade [OLDERVERSIONBEINGUPGRADED]" /> + <CustomAction Id="GUI" BinaryKey="GUI" ExeCommand="gui [OLDERVERSIONBEINGUPGRADED]" /> <CustomAction Id="InstallCommand" Property="InstallDeferred" Value=""cmd.exe" /c "set START_SERVICES=[START_SERVICES] && set HDP_LAYOUT=[HDP_LAYOUT] && set AMB_LAYOUT=[AMB_LAYOUT] && [AMBARI_SETUP_TOOLS]bootstrap_install.cmd [AMBARI_SETUP_TOOLS]"" /> <CustomAction Id="InstallDeferred" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" /> <CustomAction Id="UninstallCommand" Property="UninstallDeferred" Value=""cmd.exe" /c "[AMBARI_SETUP_TOOLS]bootstrap_uninstall.cmd [AMBARI_SETUP_TOOLS]"" /> @@ -29,6 +30,7 @@ limitations under the License. --> <CustomAction Id="Result" BinaryKey="GUI" ExeCommand="install" Execute="deferred" /> <CustomAction Id="Result_rem" BinaryKey="GUI" ExeCommand="uninstall" Execute="deferred" /> <CustomAction Id="Database" BinaryKey="GUI" ExeCommand="db" Execute="deferred" /> + <CustomAction Id="MODIFY" Error="Please uninstall current Ambari installation before installing Ambari" /> <Directory Id="TARGETDIR" Name="SourceDir"> <Directory Id="FromDir" Name="AmbariInstallFiles" ShortName="d6tzoyaf"> <Directory Id="PACKAGE_HOME" Name="AmbariPackages" ShortName="98sctbni"> @@ -56,19 +58,27 @@ limitations under the License. --> <Property Id="NETFRAMEWORK40CLIENT" Secure="yes" /> <Property Id="NETFRAMEWORK40FULL" Secure="yes" /> <Property Id="MSIUSEREALADMINDETECTION" Value="1" /> + <Property Id="OLDERVERSIONBEINGUPGRADED" Secure="yes" /> + <Property Id="RECREATE_DB" Value="yes" /> + <Upgrade Id="{CD3CAC20-F0A9-4EF7-9C75-CF660D0697AA}"> + <UpgradeVersion Minimum="1.0.0" Property="OLDERVERSIONBEINGUPGRADED" IncludeMinimum="yes" /> + </Upgrade> <InstallExecuteSequence> + <Custom Action="MODIFY" Sequence="200">Installed AND NOT REMOVE</Custom> <Custom Action="UninstallCommand" Sequence="1501">Installed</Custom> <Custom Action="UninstallDeferred" Sequence="1502">Installed</Custom> <Custom Action="InstallCommand" Sequence="4003">NOT Installed</Custom> <Custom Action="InstallDeferred" Sequence="4004">NOT Installed</Custom> - <Custom Action="Result" Sequence="6500">NOT Installed</Custom> - <Custom Action="Result_rem" Sequence="6500">REMOVE</Custom> - <Custom Action="Database" Sequence="6510">NOT Installed</Custom> + <Custom Action="Result_rem" Sequence="6500">REMOVE</Custom> + <Custom Action="Result" Sequence="6500">NOT Installed</Custom> + <Custom Action="Database" Sequence="6510">NOT Installed</Custom> <LaunchConditions Sequence="100" /> + <FindRelatedProducts Sequence="200" /> <ValidateProductID Sequence="700" /> <CostInitialize Sequence="800" /> <FileCost Sequence="900" /> <CostFinalize Sequence="1000" /> + <MigrateFeatureStates Sequence="1200" /> <InstallValidate Sequence="1400" /> <InstallInitialize Sequence="1500" /> <ProcessComponents Sequence="1600" /> @@ -84,6 +94,7 @@ limitations under the License. --> <PublishFeatures Sequence="6300" /> <PublishProduct Sequence="6400" /> <InstallFinalize Sequence="6600" /> + <RemoveExistingProducts Sequence="1401" /> </InstallExecuteSequence> <InstallUISequence> <Custom Action="INSTFAILED" OnExit="error" />
