Repository: ambari
Updated Branches:
  refs/heads/trunk bf9301247 -> 1345ec71e


AMBARI-10852: [WinTP2] Update choco install/uninstall scripts (jluniya)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1345ec71
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1345ec71
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1345ec71

Branch: refs/heads/trunk
Commit: 1345ec71ec1cc486ca9b26fe6656c1d2a40a000d
Parents: bf93012
Author: Jayush Luniya <jlun...@hortonworks.com>
Authored: Fri May 8 14:27:19 2015 -0700
Committer: Jayush Luniya <jlun...@hortonworks.com>
Committed: Fri May 8 14:27:19 2015 -0700

----------------------------------------------------------------------
 ambari-agent/pom.xml                            |  74 +-----------
 .../src/main/package/choco/ambari-agent.nuspec  |   1 +
 .../main/package/choco/chocolateyinstall.ps1    |  56 +++++++--
 .../main/package/choco/chocolateyuninstall.ps1  |  52 ++++++++-
 .../src/main/package/msi/ambari-agent.wxs       |  52 ---------
 ambari-agent/src/packages/windows-choco.xml     |   9 ++
 ambari-agent/src/packages/windows.xml           |   5 -
 ambari-common/src/main/windows/link.psm1        | 114 +++++++++++++++++++
 ambari-common/src/main/windows/retry.psm1       |  50 ++++++++
 ambari-server/pom.xml                           |  78 -------------
 .../main/assemblies/server-windows-choco.xml    |   9 ++
 .../src/main/assemblies/server-windows.xml      |   5 -
 .../src/main/package/choco/ambari-server.nuspec |   1 +
 .../main/package/choco/chocolateyinstall.ps1    |  56 +++++++--
 .../main/package/choco/chocolateyuninstall.ps1  |  54 ++++++++-
 .../src/main/package/msi/ambari-server.wxs      |  50 --------
 ambari-server/src/main/python/bootstrap.py      |  53 +++++++--
 ambari-server/src/main/python/setupAgent.py     |   7 +-
 .../windows/psremoting/Configure-Chocolatey.ps1 |  45 ++++++++
 pom.xml                                         |   1 +
 20 files changed, 475 insertions(+), 297 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1345ec71/ambari-agent/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-agent/pom.xml b/ambari-agent/pom.xml
index a5f2808..b807ba9 100644
--- a/ambari-agent/pom.xml
+++ b/ambari-agent/pom.xml
@@ -721,7 +721,6 @@
             <exclude>**/*.erb</exclude>
             <exclude>**/*.json</exclude>
             <exclude>**/*.pydevproject</exclude>
-            <exclude>**/*.wxs</exclude>
             <exclude>src/main/package/choco/ambari-agent.nuspec</exclude>
           </excludes>
         </configuration>
@@ -840,39 +839,13 @@
               </execution>
             </executions>
           </plugin>
-          <!-- msi creation -->
+          <!-- choco package creation -->
           <plugin>
             <groupId>org.codehaus.mojo</groupId>
             <artifactId>exec-maven-plugin</artifactId>
             <version>1.2.1</version>
             <executions>
               <execution>
-                <id>run-heat</id>
-                <phase>package</phase>
-                <goals>
-                  <goal>exec</goal>
-                </goals>
-                <configuration>
-                  <executable>heat.exe</executable>
-                  <arguments>
-                    <argument>dir</argument>
-                    <argument>"."</argument>
-                    <argument>-dr</argument>
-                    <argument>"AGENT_INSTALL_DIRECTORY"</argument>
-                    <argument>-platform</argument>
-                    <argument>Win64</argument>
-                    <argument>-cg</argument>
-                    <argument>"AmbariAgentGroup"</argument>
-                    <argument>-gg</argument>
-                    <argument>-ke</argument>
-                    <argument>-srd</argument>
-                    <argument>-o</argument>
-                    <argument>".\..\ambari-agent-files.wxs"</argument>
-                  </arguments>
-                  
<workingDirectory>${basedir}/target/${final.name}-windows-dist</workingDirectory>
-                </configuration>
-              </execution>
-              <execution>
                 <id>build-choco-package</id>
                 <phase>package</phase>
                 <goals>
@@ -890,50 +863,7 @@
               </execution>
             </executions>
           </plugin>
-          <plugin>
-            <groupId>org.apache.npanday.plugins</groupId>
-            <artifactId>wix-maven-plugin</artifactId>
-            <version>1.4.0-incubating</version>
-            <extensions>true</extensions>
-            <configuration>
-              <sourceFiles>
-                <sourceFile>target/ambari-agent.wxs</sourceFile>
-                <sourceFile>target/ambari-agent-files.wxs</sourceFile>
-              </sourceFiles>
-              <outputDirectory>target</outputDirectory>
-              <objectFiles>
-                <objectFile>target/ambari-agent.wixobj</objectFile>
-                <objectFile>target/ambari-agent-files.wixobj</objectFile>
-              </objectFiles>
-              
<outputFile>target/ambari-agent-${project.version}.msi</outputFile>
-              <extensions>
-                <extension>WixUIExtension</extension>
-              </extensions>
-            </configuration>
-            <executions>
-              <execution>
-                <id>wix-candle</id>
-                <phase>package</phase>
-                <goals>
-                  <goal>candle</goal>
-                </goals>
-                <configuration>
-                  <arguments>-arch x64</arguments>
-                </configuration>
-              </execution>
-              <execution>
-                <id>wix-light</id>
-                <phase>package</phase>
-                <goals>
-                  <goal>light</goal>
-                </goals>
-                <configuration>
-                  <arguments>-b 
${basedir}/target/${final.name}-windows-dist</arguments>
-                </configuration>
-              </execution>
-            </executions>
-          </plugin>
-            <!-- end msi creation -->
+            <!-- end choco package creation -->
         </plugins>
       </build>
     </profile>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1345ec71/ambari-agent/src/main/package/choco/ambari-agent.nuspec
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/package/choco/ambari-agent.nuspec 
b/ambari-agent/src/main/package/choco/ambari-agent.nuspec
index d7efb4d..f3b8507 100644
--- a/ambari-agent/src/main/package/choco/ambari-agent.nuspec
+++ b/ambari-agent/src/main/package/choco/ambari-agent.nuspec
@@ -21,5 +21,6 @@
   <files>
     <file src="tools\**" target="tools" />
     <file src="content\**" target="content" />
+    <file src="modules\**" target="modules" />
   </files>
 </package>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1345ec71/ambari-agent/src/main/package/choco/chocolateyinstall.ps1
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/package/choco/chocolateyinstall.ps1 
b/ambari-agent/src/main/package/choco/chocolateyinstall.ps1
index 3d95e72..7a9ddc2 100644
--- a/ambari-agent/src/main/package/choco/chocolateyinstall.ps1
+++ b/ambari-agent/src/main/package/choco/chocolateyinstall.ps1
@@ -13,18 +13,60 @@
 # See the License for the specific language governing permissions and
 # limitations under the License
 
-# stop on all errors
+# Stop on all errors
 $ErrorActionPreference = 'Stop';
 
+# Package Name
 $packageName = $Env:chocolateyPackageName
+# Package Version
 $packageVersion = $Env:chocolateyPackageVersion
-$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
-$rootDir = "$(Split-Path -parent $toolsDir)"
-$contentDir = "$(Join-Path $rootDir content)"
+# Package Folder
+$packageFolder = $Env:chocolateyPackageFolder
+# Package Parameters
+$packageParameters = $env:chocolateyPackageParameters
 
-$zipFile = "$(Join-Path $contentDir 
$packageName-$packageVersion-windows-dist.zip)"
+$arguments = @{}
 $ambariRoot = "C:\ambari"
+$retries = 5
+# Parse the packageParameters
+#   /AmbariRoot:C:\ambari /Retries:5
+if ($packageParameters) {
+  $match_pattern = "\/(?<option>([a-zA-Z]+)):(?<value>([`"'])?([a-zA-Z0-9- 
_\\:\.]+)([`"'])?)|\/(?<option>([a-zA-Z]+))"
+  $option_name = 'option'
+  $value_name = 'value'
+
+  if ($packageParameters -match $match_pattern ){
+    $results = $packageParameters | Select-String $match_pattern -AllMatches
+    $results.matches | % {
+      $arguments.Add(
+        $_.Groups[$option_name].Value.Trim(),
+        $_.Groups[$value_name].Value.Trim())
+    }
+  } else {
+    Throw "Package Parameters were found but were invalid (REGEX Failure)"
+  }
+  if ($arguments.ContainsKey("AmbariRoot")) {
+    Write-Debug "AmbariRoot Argument Found"
+    $ambariRoot = $arguments["AmbariRoot"]
+  }
+  if ($arguments.ContainsKey("Retries")) {
+    Write-Debug "Retries Argument Found"
+    $retries = $arguments["Retries"]
+  }
+} else {
+  Write-Debug "No Package Parameters Passed in"
+}
+
+$modulesFolder = "$(Join-Path $packageFolder modules)"
+$contentFolder = "$(Join-Path $packageFolder content)"
+$zipFile = "$(Join-Path $contentFolder 
$packageName-$packageVersion-windows-dist.zip)"
 $specificFolder = ""
+$link = "$ambariRoot\$packageName"
+$target = "$ambariRoot\$packageName-$packageVersion"
+
+Import-Module "$modulesFolder\link.psm1"
+Import-Module "$modulesFolder\retry.psm1"
 
-Get-ChocolateyUnzip "$zipFile" "$ambariRoot\$packageName-$packageVersion" 
$specificFolder $packageName
-cmd /c mklink /D "$ambariRoot\$packageName" 
"$ambariRoot\$packageName-$packageVersion"
\ No newline at end of file
+Retry-Command -Command "Get-ChocolateyUnzip" -Arguments @{ FileFullPath = 
$zipFile; Destination = $target; SpecificFolder = $specificFolder; PackageName 
= $packageName} -Retries $retries
+Retry-Command -Command "Remove-Symlink-IfExists" -Arguments @{Link = $link} 
-Retries $retries
+Retry-Command -Command "New-Symlink" -Arguments @{ Link = $link; Target = 
$target } -Retries $retries

http://git-wip-us.apache.org/repos/asf/ambari/blob/1345ec71/ambari-agent/src/main/package/choco/chocolateyuninstall.ps1
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/package/choco/chocolateyuninstall.ps1 
b/ambari-agent/src/main/package/choco/chocolateyuninstall.ps1
index 493da40..af2b2ae 100644
--- a/ambari-agent/src/main/package/choco/chocolateyuninstall.ps1
+++ b/ambari-agent/src/main/package/choco/chocolateyuninstall.ps1
@@ -13,11 +13,57 @@
 # See the License for the specific language governing permissions and
 # limitations under the License
 
-# stop on all errors
+# Stop on all errors
 $ErrorActionPreference = 'Stop';
+
+# Package Name
 $packageName = $Env:chocolateyPackageName
+# Package Version
 $packageVersion = $Env:chocolateyPackageVersion
+# Package Folder
+$packageFolder = $Env:chocolateyPackageFolder
+# Package Parameters
+$packageParameters = $env:chocolateyPackageParameters
+
+$arguments = @{}
 $ambariRoot = "C:\ambari"
+$retries = 5
+# Parse the packageParameters
+#   /AmbariRoot:C:\ambari /Retries:5
+if ($packageParameters) {
+  $match_pattern = "\/(?<option>([a-zA-Z]+)):(?<value>([`"'])?([a-zA-Z0-9- 
_\\:\.]+)([`"'])?)|\/(?<option>([a-zA-Z]+))"
+  $option_name = 'option'
+  $value_name = 'value'
+
+  if ($packageParameters -match $match_pattern ){
+    $results = $packageParameters | Select-String $match_pattern -AllMatches
+    $results.matches | % {
+      $arguments.Add(
+        $_.Groups[$option_name].Value.Trim(),
+        $_.Groups[$value_name].Value.Trim())
+    }
+  } else {
+    Throw "Package Parameters were found but were invalid (REGEX Failure)"
+  }
+  if ($arguments.ContainsKey("AmbariRoot")) {
+    Write-Debug "AmbariRoot Argument Found"
+    $ambariRoot = $arguments["AmbariRoot"]
+  }
+  if ($arguments.ContainsKey("Retries")) {
+    Write-Debug "Retries Argument Found"
+    $retries = $arguments["Retries"]
+  }
+} else {
+  Write-Debug "No Package Parameters Passed in"
+}
+
+$modulesFolder = "$(Join-Path $packageFolder modules)"
+$contentFolder = "$(Join-Path $packageFolder content)"
+$link = "$ambariRoot\$packageName"
+$target = "$ambariRoot\$packageName-$packageVersion"
+
+Import-Module "$modulesFolder\link.psm1"
+Import-Module "$modulesFolder\retry.psm1"
 
-cmd /c rmdir "$ambariRoot\$packageName"
-cmd /c rmdir /s/q "$ambariRoot\$packageName-$packageVersion"
\ No newline at end of file
+Retry-Command -Command "Remove-Symlink-IfExists" -Arguments @{Link = $link} 
-Retries $retries
+Retry-Command -Command "Remove-Item" -Arguments @{ Path = $target; Recurse = 
$true; Force = $true }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/1345ec71/ambari-agent/src/main/package/msi/ambari-agent.wxs
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/package/msi/ambari-agent.wxs 
b/ambari-agent/src/main/package/msi/ambari-agent.wxs
deleted file mode 100644
index 3f292f4..0000000
--- a/ambari-agent/src/main/package/msi/ambari-agent.wxs
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   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.
--->
-<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi";>
-  <?define Version = "${ambariVersion}" ?>
-  <Product Id="efc59d96-ea09-4a0d-ba90-317dc53cb6da" Name="Ambari Agent 
${ambariVersion}" Language="1033"
-           Version="$(var.Version)" Manufacturer="Apache Software Foundation">
-    <Package Description="Ambari Agent for Windows" Comments="Ambari Agent for 
Windows" InstallerVersion="200"
-             Compressed="yes" Platform="x64"/>
-
-    <Media Id="1" Cabinet="simple.cab" EmbedCab="yes"/>
-
-    <Directory Id="TARGETDIR" Name="SourceDir">
-      <Directory Id="AmbariDirectory" Name="ambari">
-        <Directory Id="AGENT_INSTALL_DIRECTORY" 
Name="ambari-agent-$(var.Version)">
-        </Directory>
-      </Directory>
-    </Directory>
-
-    <Feature Id="DefaultFeature" Title="Main Feature" Level="1">
-      <ComponentGroupRef Id="AmbariAgentGroup"/>
-    </Feature>
-    <Property Id="WIXUI_INSTALLDIR" Value="AGENT_INSTALL_DIRECTORY"/>
-    <UI>
-      <UIRef Id="WixUI_InstallDir" />
-      <Publish Dialog="WelcomeDlg"
-               Control="Next"
-               Event="NewDialog"
-               Value="InstallDirDlg"
-               Order="2">1</Publish>
-      <Publish Dialog="InstallDirDlg"
-               Control="Back"
-               Event="NewDialog"
-               Value="WelcomeDlg"
-               Order="2">1</Publish>
-    </UI>
-  </Product>
-</Wix>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1345ec71/ambari-agent/src/packages/windows-choco.xml
----------------------------------------------------------------------
diff --git a/ambari-agent/src/packages/windows-choco.xml 
b/ambari-agent/src/packages/windows-choco.xml
index 20edba9..5861987 100644
--- a/ambari-agent/src/packages/windows-choco.xml
+++ b/ambari-agent/src/packages/windows-choco.xml
@@ -39,4 +39,13 @@
       <outputDirectory>tools</outputDirectory>
     </file>
   </files>
+  <fileSets>
+    <fileSet>
+      <directory>${basedir}/../ambari-common/src/main/windows</directory>
+      <outputDirectory>modules</outputDirectory>
+      <includes>
+        <include>*.psm1</include>
+      </includes>
+    </fileSet>
+  </fileSets>
 </assembly>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1345ec71/ambari-agent/src/packages/windows.xml
----------------------------------------------------------------------
diff --git a/ambari-agent/src/packages/windows.xml 
b/ambari-agent/src/packages/windows.xml
index ba18ef0..d4dbe0f 100644
--- a/ambari-agent/src/packages/windows.xml
+++ b/ambari-agent/src/packages/windows.xml
@@ -79,10 +79,5 @@
       <outputDirectory>data</outputDirectory>
       <filtered>true</filtered>
     </file>
-    <file>
-      <source>${basedir}/src/main/package/msi/ambari-agent.wxs</source>
-      <outputDirectory>../../</outputDirectory>
-      <filtered>true</filtered>
-    </file>
   </files>
 </assembly>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1345ec71/ambari-common/src/main/windows/link.psm1
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/windows/link.psm1 
b/ambari-common/src/main/windows/link.psm1
new file mode 100644
index 0000000..bf2c803
--- /dev/null
+++ b/ambari-common/src/main/windows/link.psm1
@@ -0,0 +1,114 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# 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
+
+Function New-Symlink {
+  param (
+    [Parameter(Position=0, Mandatory=$true)]
+    [string] $link,
+    [Parameter(Position=1, Mandatory=$true)]
+    [string] $target
+  )
+  Invoke-Mklink -Link $link -Target $target -Symlink
+}
+
+Function Remove-Symlink {
+  param (
+    [Parameter(Position=0, Mandatory=$true)]
+    [string] $link
+  )
+
+  if(-not(Test-Path $link)) {
+    throw "Symbolic link $link does not exist!"
+  }
+
+  $cmd = ""
+  if (Test-Path -PathType Container $link) {
+      $cmd = "cmd /c rmdir"
+  } else {
+    $cmd = "cmd /c del"
+  }
+
+  $output = Invoke-Expression "$cmd `"$link`" 2>&1"
+
+  if ($lastExitCode -ne 0) {
+    throw "Failed to delete link $link.`nExit code: $lastExitCode`nOutput: 
$output"
+  } else {
+    Write-Output $output
+  }
+}
+
+Function Remove-Symlink-IfExists {
+  param (
+    [Parameter(Position=0, Mandatory=$true)]
+    [string] $link
+  )
+
+  if(Test-Path $link) {
+    Remove-Symlink -Link $link
+  }
+}
+
+Function New-Hardlink {
+  param (
+    [Parameter(Position=0, Mandatory=$true)]
+    [string] $link,
+    [Parameter(Position=1, Mandatory=$true)]
+    [string] $target
+  )
+  Invoke-Mklink -Link $link -Target $target -Hardlink
+}
+
+Function Invoke-Mklink {
+  [CmdletBinding(DefaultParameterSetName = "Symlink")]
+  param (
+    [Parameter(Position=0, Mandatory=$true)]
+    [string] $link,
+    [Parameter(Position=1, Mandatory=$true)]
+    [string] $target,
+
+    [Parameter(ParameterSetName = "Symlink")]
+    [switch] $symlink = $true,
+    [Parameter(ParameterSetName = "HardLink")]
+    [switch] $hardlink
+  )
+
+  if(-not(Test-Path $target)) {
+    throw "Target $target does not exist!"
+  }
+  if(Test-Path $link) {
+    throw "Link $link already exists!"
+  }
+
+  $isDirectory = Test-Path -PathType Container $target
+  $cmd = "cmd /c mklink"
+  if($isDirectory) {
+    if($hardlink) {
+      throw "Target $target is a directory. Hard links cannot be created for 
directories!"
+    }
+    $cmd += " /D"
+  }
+  if($hardlink) {
+    $cmd += " /H"
+  }
+
+  $output = Invoke-Expression "$cmd `"$link`" `"$target`" 2>&1"
+  if ($lastExitCode -ne 0) {
+    throw "Failed to create a link using mklink.`nExit code: 
$lastExitCode`nOutput: $output"
+  } else {
+    Write-Output $output
+  }
+}
+
+Export-ModuleMember New-Symlink, Remove-Symlink, Remove-Symlink-IfExists, 
New-Hardlink, Remove-Hardlink
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/1345ec71/ambari-common/src/main/windows/retry.psm1
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/windows/retry.psm1 
b/ambari-common/src/main/windows/retry.psm1
new file mode 100644
index 0000000..e4ebc8f
--- /dev/null
+++ b/ambari-common/src/main/windows/retry.psm1
@@ -0,0 +1,50 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# 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
+
+function Retry-Command
+{
+  param (
+    [Parameter(Mandatory=$true)]
+    [string]$command,
+    [Parameter(Mandatory=$true)]
+    [hashtable]$arguments,
+
+    [Parameter(Mandatory=$false)]
+    [int]$retries = 5,
+    [Parameter(Mandatory=$false)]
+    [int]$secondsDelay = 2
+  )
+
+  $retrycount = 0
+  $done = $false
+  while (-not $done) {
+    try {
+      & $command @arguments
+      Write-Host ("Command [$command] succeeded.")
+      $done = $true
+    } catch {
+      $errorMessage = $_.Exception.Message
+      $failedItem = $_.Exception.ItemName
+      if ($retrycount -ge $retries) {
+        Write-Host ("Command [$command] failed the maximum number of 
$retrycount times.")
+        throw
+      } else {
+        Write-Host ("Command [$command] failed.`nError Message: 
$errorMessage`nRetrying in $secondsDelay seconds.")
+        Start-Sleep $secondsDelay
+        $retrycount++
+      }
+    }
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/1345ec71/ambari-server/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-server/pom.xml b/ambari-server/pom.xml
index 0d37429..8efd1ec 100644
--- a/ambari-server/pom.xml
+++ b/ambari-server/pom.xml
@@ -182,7 +182,6 @@
             <exclude>**/*.iml</exclude>
             <exclude>**/*.json</exclude>
             <exclude>**/*.sql</exclude>
-            <exclude>**/*.wxs</exclude>
             <exclude>**/repo_suse_rhel.j2</exclude>
             <exclude>**/repo_debian.j2</exclude>
             <exclude>**/cluster.properties.j2</exclude>
@@ -1377,32 +1376,6 @@
             <version>1.2.1</version>
             <executions>
               <execution>
-                <id>run-heat</id>
-                <phase>package</phase>
-                <goals>
-                  <goal>exec</goal>
-                </goals>
-                <configuration>
-                  <executable>heat.exe</executable>
-                  <arguments>
-                    <argument>dir</argument>
-                    <argument>"."</argument>
-                    <argument>-dr</argument>
-                    <argument>"SERVER_INSTALL_DIRECTORY"</argument>
-                    <argument>-platform</argument>
-                    <argument>Win64</argument>
-                    <argument>-cg</argument>
-                    <argument>"AmbariServerGroup"</argument>
-                    <argument>-gg</argument>
-                    <argument>-ke</argument>
-                    <argument>-srd</argument>
-                    <argument>-o</argument>
-                    <argument>".\..\..\ambari-server-files.wxs"</argument>
-                  </arguments>
-                  
<workingDirectory>target/ambari-server-${project.version}-dist/ambari-server-${project.version}</workingDirectory>
-                </configuration>
-              </execution>
-              <execution>
                 <id>build-choco-package</id>
                 <phase>package</phase>
                 <goals>
@@ -1420,59 +1393,8 @@
               </execution>
             </executions>
           </plugin>
-          <plugin>
-            <groupId>org.apache.npanday.plugins</groupId>
-            <artifactId>wix-maven-plugin</artifactId>
-            <version>1.4.0-incubating</version>
-            <extensions>true</extensions>
-            <configuration>
-              <sourceFiles>
-                <sourceFile>target/ambari-server.wxs</sourceFile>
-                <sourceFile>target/ambari-server-files.wxs</sourceFile>
-              </sourceFiles>
-              <outputDirectory>target</outputDirectory>
-              <objectFiles>
-                <objectFile>target/ambari-server.wixobj</objectFile>
-                <objectFile>target/ambari-server-files.wixobj</objectFile>
-              </objectFiles>
-              
<outputFile>target/ambari-server-${project.version}.msi</outputFile>
-              <extensions>
-                <extension>WixUIExtension</extension>
-              </extensions>
-            </configuration>
-            <executions>
-              <execution>
-                <id>wix-candle</id>
-                <phase>package</phase>
-                <goals>
-                  <goal>candle</goal>
-                </goals>
-                <configuration>
-                  <arguments>-arch x64</arguments>
-                </configuration>
-              </execution>
-              <execution>
-                <id>wix-light</id>
-                <phase>package</phase>
-                <goals>
-                  <goal>light</goal>
-                </goals>
-                <configuration>
-                  <arguments>-b 
${basedir}/target/ambari-server-${project.version}-dist/ambari-server-${project.version}</arguments>
-                </configuration>
-              </execution>
-            </executions>
-          </plugin>
         </plugins>
       </build>
-      <dependencies>
-        <dependency>
-          <groupId>org.apache.npanday.plugins</groupId>
-          <artifactId>wix-maven-plugin</artifactId>
-          <version>1.4.0-incubating</version>
-          <scope>test</scope>
-        </dependency>
-      </dependencies>
     </profile>
     <profile>
       <id>linux</id>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1345ec71/ambari-server/src/main/assemblies/server-windows-choco.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/assemblies/server-windows-choco.xml 
b/ambari-server/src/main/assemblies/server-windows-choco.xml
index 8aec023..4dc9328 100644
--- a/ambari-server/src/main/assemblies/server-windows-choco.xml
+++ b/ambari-server/src/main/assemblies/server-windows-choco.xml
@@ -39,4 +39,13 @@
       <outputDirectory>tools</outputDirectory>
     </file>
   </files>
+  <fileSets>
+    <fileSet>
+      <directory>${basedir}/../ambari-common/src/main/windows</directory>
+      <outputDirectory>modules</outputDirectory>
+      <includes>
+        <include>*.psm1</include>
+      </includes>
+    </fileSet>
+  </fileSets>
 </assembly>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1345ec71/ambari-server/src/main/assemblies/server-windows.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/assemblies/server-windows.xml 
b/ambari-server/src/main/assemblies/server-windows.xml
index 4f9c874..f4ba5a7 100644
--- a/ambari-server/src/main/assemblies/server-windows.xml
+++ b/ambari-server/src/main/assemblies/server-windows.xml
@@ -76,11 +76,6 @@
       <source>${project.build.directory}/version</source>
       <outputDirectory>ambari-server-${project.version}/</outputDirectory>
     </file>
-    <file>
-      <source>${basedir}/src/main/package/msi/ambari-server.wxs</source>
-      <outputDirectory>../../</outputDirectory>
-      <filtered>true</filtered>
-    </file>
   </files>
   <fileSets>
     <!-- Distro files, readme, licenses, etc -->

http://git-wip-us.apache.org/repos/asf/ambari/blob/1345ec71/ambari-server/src/main/package/choco/ambari-server.nuspec
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/package/choco/ambari-server.nuspec 
b/ambari-server/src/main/package/choco/ambari-server.nuspec
index 851e644..2723379 100644
--- a/ambari-server/src/main/package/choco/ambari-server.nuspec
+++ b/ambari-server/src/main/package/choco/ambari-server.nuspec
@@ -21,5 +21,6 @@
   <files>
     <file src="tools\**" target="tools" />
     <file src="content\**" target="content" />
+    <file src="modules\**" target="modules" />
   </files>
 </package>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1345ec71/ambari-server/src/main/package/choco/chocolateyinstall.ps1
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/package/choco/chocolateyinstall.ps1 
b/ambari-server/src/main/package/choco/chocolateyinstall.ps1
index becf079..a9d74e6 100644
--- a/ambari-server/src/main/package/choco/chocolateyinstall.ps1
+++ b/ambari-server/src/main/package/choco/chocolateyinstall.ps1
@@ -13,18 +13,60 @@
 # See the License for the specific language governing permissions and
 # limitations under the License
 
-# stop on all errors
+# Stop on all errors
 $ErrorActionPreference = 'Stop';
 
+# Package Name
 $packageName = $Env:chocolateyPackageName
+# Package Version
 $packageVersion = $Env:chocolateyPackageVersion
-$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
-$rootDir = "$(Split-Path -parent $toolsDir)"
-$contentDir = "$(Join-Path $rootDir content)"
+# Package Folder
+$packageFolder = $Env:chocolateyPackageFolder
+# Package Parameters
+$packageParameters = $env:chocolateyPackageParameters
 
-$zipFile = "$(Join-Path $contentDir $packageName-$packageVersion-dist.zip)"
+$arguments = @{}
 $ambariRoot = "C:\ambari"
+$retries = 5
+# Parse the packageParameters
+#   /AmbariRoot:C:\ambari /Retries:5
+if ($packageParameters) {
+  $match_pattern = "\/(?<option>([a-zA-Z]+)):(?<value>([`"'])?([a-zA-Z0-9- 
_\\:\.]+)([`"'])?)|\/(?<option>([a-zA-Z]+))"
+  $option_name = 'option'
+  $value_name = 'value'
+
+  if ($packageParameters -match $match_pattern ){
+    $results = $packageParameters | Select-String $match_pattern -AllMatches
+    $results.matches | % {
+      $arguments.Add(
+        $_.Groups[$option_name].Value.Trim(),
+        $_.Groups[$value_name].Value.Trim())
+    }
+  } else {
+    Throw "Package Parameters were found but were invalid (REGEX Failure)"
+  }
+  if ($arguments.ContainsKey("AmbariRoot")) {
+    Write-Debug "AmbariRoot Argument Found"
+    $ambariRoot = $arguments["AmbariRoot"]
+  }
+  if ($arguments.ContainsKey("Retries")) {
+    Write-Debug "Retries Argument Found"
+    $retries = $arguments["Retries"]
+  }
+} else {
+  Write-Debug "No Package Parameters Passed in"
+}
+
+$modulesFolder = "$(Join-Path $packageFolder modules)"
+$contentFolder = "$(Join-Path $packageFolder content)"
+$zipFile = "$(Join-Path $contentFolder $packageName-$packageVersion-dist.zip)"
 $specificFolder = ""
+$link = "$ambariRoot\$packageName"
+$target = "$ambariRoot\$packageName-$packageVersion"
+
+Import-Module "$modulesFolder\link.psm1"
+Import-Module "$modulesFolder\retry.psm1"
 
-Get-ChocolateyUnzip "$zipFile" $ambariRoot $specificFolder $packageName
-cmd /c mklink /D "$ambariRoot\$packageName" 
"$ambariRoot\$packageName-$packageVersion"
\ No newline at end of file
+Retry-Command -Command "Get-ChocolateyUnzip" -Arguments @{ FileFullPath = 
$zipFile; Destination = $ambariRoot; SpecificFolder = $specificFolder; 
PackageName = $packageName} -Retries $retries
+Retry-Command -Command "Remove-Symlink-IfExists" -Arguments @{Link = $link} 
-Retries $retries
+Retry-Command -Command "New-Symlink" -Arguments @{ Link = $link; Target = 
$target } -Retries $retries

http://git-wip-us.apache.org/repos/asf/ambari/blob/1345ec71/ambari-server/src/main/package/choco/chocolateyuninstall.ps1
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/package/choco/chocolateyuninstall.ps1 
b/ambari-server/src/main/package/choco/chocolateyuninstall.ps1
index 503fb72..fe6bdbd 100644
--- a/ambari-server/src/main/package/choco/chocolateyuninstall.ps1
+++ b/ambari-server/src/main/package/choco/chocolateyuninstall.ps1
@@ -13,11 +13,57 @@
 # See the License for the specific language governing permissions and
 # limitations under the License
 
-# stop on all errors
+# Stop on all errors
 $ErrorActionPreference = 'Stop';
+
+# Package Name
 $packageName = $Env:chocolateyPackageName
+# Package Version
 $packageVersion = $Env:chocolateyPackageVersion
-$unzipLocation = "C:\ambari"
+# Package Folder
+$packageFolder = $Env:chocolateyPackageFolder
+# Package Parameters
+$packageParameters = $env:chocolateyPackageParameters
+
+$arguments = @{}
+$ambariRoot = "C:\ambari"
+$retries = 5
+# Parse the packageParameters
+#   /AmbariRoot:C:\ambari /Retries:5
+if ($packageParameters) {
+  $match_pattern = "\/(?<option>([a-zA-Z]+)):(?<value>([`"'])?([a-zA-Z0-9- 
_\\:\.]+)([`"'])?)|\/(?<option>([a-zA-Z]+))"
+  $option_name = 'option'
+  $value_name = 'value'
+
+  if ($packageParameters -match $match_pattern ){
+    $results = $packageParameters | Select-String $match_pattern -AllMatches
+    $results.matches | % {
+      $arguments.Add(
+        $_.Groups[$option_name].Value.Trim(),
+        $_.Groups[$value_name].Value.Trim())
+    }
+  } else {
+    Throw "Package Parameters were found but were invalid (REGEX Failure)"
+  }
+  if ($arguments.ContainsKey("AmbariRoot")) {
+    Write-Debug "AmbariRoot Argument Found"
+    $ambariRoot = $arguments["AmbariRoot"]
+  }
+  if ($arguments.ContainsKey("Retries")) {
+    Write-Debug "Retries Argument Found"
+    $retries = $arguments["Retries"]
+  }
+} else {
+  Write-Debug "No Package Parameters Passed in"
+}
+
+$modulesFolder = "$(Join-Path $packageFolder modules)"
+$contentFolder = "$(Join-Path $packageFolder content)"
+$link = "$ambariRoot\$packageName"
+$target = "$ambariRoot\$packageName-$packageVersion"
+
+Import-Module "$modulesFolder\link.psm1"
+Import-Module "$modulesFolder\retry.psm1"
 
-cmd /c rmdir "$unzipLocation\$packageName"
-cmd /c rmdir /s/q "$unzipLocation\$packageName-$packageVersion"
\ No newline at end of file
+Retry-Command -Command "Remove-Symlink-IfExists" -Arguments @{Link = $link} 
-Retries $retries
+Retry-Command -Command "Remove-Item" -Arguments @{ Path = $target; Recurse = 
$true; Force = $true }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1345ec71/ambari-server/src/main/package/msi/ambari-server.wxs
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/package/msi/ambari-server.wxs 
b/ambari-server/src/main/package/msi/ambari-server.wxs
deleted file mode 100644
index e9adbc6..0000000
--- a/ambari-server/src/main/package/msi/ambari-server.wxs
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   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.
--->
-<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi";>
-  <?define Version = "${ambariVersion}" ?>
-  <Product Id="c8f5c145-c0aa-4d50-b1f5-ac9bc4055fb8" Name="Ambari Server 
${ambariVersion}" Language="1033"
-           Version="$(var.Version)" Manufacturer="Apache Software Foundation">
-    <Package Description="Ambari Server for Windows" Comments="Ambari Server 
for Windows" InstallerVersion="200"
-             Compressed="yes" Platform="x64"/>
-
-    <Media Id="1" Cabinet="simple.cab" EmbedCab="yes"/>
-    <Directory Id="TARGETDIR" Name="SourceDir">
-      <Directory Id="AmbariDirectory" Name="ambari">
-        <Directory Id="SERVER_INSTALL_DIRECTORY" 
Name="ambari-server-$(var.Version)">
-        </Directory>
-      </Directory>
-    </Directory>
-    <Feature Id="DefaultFeature" Title="Main Feature" Level="1">
-      <ComponentGroupRef Id="AmbariServerGroup"/>
-    </Feature>
-    <Property Id="WIXUI_INSTALLDIR" Value="SERVER_INSTALL_DIRECTORY"/>
-    <UI>
-      <UIRef Id="WixUI_InstallDir" />
-      <Publish Dialog="WelcomeDlg"
-               Control="Next"
-               Event="NewDialog"
-               Value="InstallDirDlg"
-               Order="2">1</Publish>
-      <Publish Dialog="InstallDirDlg"
-               Control="Back"
-               Event="NewDialog"
-               Value="WelcomeDlg"
-               Order="2">1</Publish>
-    </UI>
-  </Product>
-</Wix>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1345ec71/ambari-server/src/main/python/bootstrap.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/bootstrap.py 
b/ambari-server/src/main/python/bootstrap.py
index 0173159..436d631 100755
--- a/ambari-server/src/main/python/bootstrap.py
+++ b/ambari-server/src/main/python/bootstrap.py
@@ -51,11 +51,6 @@ DEFAULT_AGENT_TEMP_FOLDER = "/var/lib/ambari-agent/data/tmp"
 DEFAULT_AGENT_DATA_FOLDER = "/var/lib/ambari-agent/data"
 DEFAULT_AGENT_LIB_FOLDER = "/var/lib/ambari-agent"
 PYTHON_ENV="env PYTHONPATH=$PYTHONPATH:" + DEFAULT_AGENT_TEMP_FOLDER
-CREATE_REMOTING_DIR_SCRIPT_NAME = "Create-RemotingDir.ps1"
-SEND_REMOTING_FILE_SCRIPT_NAME = "Send-RemotingFile.ps1"
-UNZIP_REMOTING_SCRIPT_NAME = "Unzip-RemotingFile.ps1"
-RUN_REMOTING_SCRIPT_NAME = "Run-RemotingScript.ps1"
-
 
 class HostLog:
   """ Provides per-host logging. """
@@ -266,7 +261,17 @@ class Bootstrap(threading.Thread):
 
 @OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY)
 class BootstrapWindows(Bootstrap):
-  bootstrapArchiveName = "bootstrap.zip"
+  CREATE_REMOTING_DIR_SCRIPT_NAME = "Create-RemotingDir.ps1"
+  SEND_REMOTING_FILE_SCRIPT_NAME = "Send-RemotingFile.ps1"
+  UNZIP_REMOTING_SCRIPT_NAME = "Unzip-RemotingFile.ps1"
+  RUN_REMOTING_SCRIPT_NAME = "Run-RemotingScript.ps1"
+  CONFIGURE_CHOCOLATEY_SCRIPT_NAME = "Configure-Chocolatey.ps1"
+
+  BOOTSTRAP_ARCHIVE_NAME = "bootstrap.zip"
+  CHOCOLATEY_INSTALL_VAR_NAME = "ChocolateyInstall"
+  CHOCOLATEY_CONFIG_DIR = "config"
+  CHOCOLATEY_CONFIG_FILENAME = "chocolatey.config"
+  chocolateyConfigName = "chocolatey.config"
 
   def getTempFolder(self):
     installationDrive = os.path.splitdrive(self.shared_state.script_dir)[0]
@@ -276,7 +281,7 @@ class BootstrapWindows(Bootstrap):
     # Creating target dir
     self.host_log.write("==========================\n")
     self.host_log.write("Creating target directory...")
-    command = os.path.join(self.shared_state.script_dir, 
CREATE_REMOTING_DIR_SCRIPT_NAME)
+    command = os.path.join(self.shared_state.script_dir, 
self.CREATE_REMOTING_DIR_SCRIPT_NAME)
     psr = PSR(command, self.host, self.host_log, params="{0} 
{1}".format(self.host, self.getTempFolder()))
     retcode = psr.run()
     self.host_log.write("\n")
@@ -284,10 +289,10 @@ class BootstrapWindows(Bootstrap):
 
   def unzippingBootstrapArchive(self):
     # Unzipping bootstrap archive
-    zipFile = os.path.join(self.getTempFolder(), self.bootstrapArchiveName)
+    zipFile = os.path.join(self.getTempFolder(), self.BOOTSTRAP_ARCHIVE_NAME)
     self.host_log.write("==========================\n")
     self.host_log.write("Unzipping bootstrap archive...")
-    command = os.path.join(self.shared_state.script_dir, 
UNZIP_REMOTING_SCRIPT_NAME)
+    command = os.path.join(self.shared_state.script_dir, 
self.UNZIP_REMOTING_SCRIPT_NAME)
     psr = PSR(command, self.host, self.host_log, params="{0} {1} 
{2}".format(self.host, zipFile, self.getTempFolder()))
     result = psr.run()
     self.host_log.write("\n")
@@ -296,15 +301,37 @@ class BootstrapWindows(Bootstrap):
   def copyBootstrapArchive(self):
     # Copying the bootstrap archive file
     fileToCopy = os.path.join(self.shared_state.script_dir, 
os.path.dirname(self.shared_state.script_dir), 
self.shared_state.setup_agent_file)
-    target = os.path.join(self.getTempFolder(), self.bootstrapArchiveName)
+    target = os.path.join(self.getTempFolder(), self.BOOTSTRAP_ARCHIVE_NAME)
     self.host_log.write("==========================\n")
     self.host_log.write("Copying bootstrap archive...")
-    command = os.path.join(self.shared_state.script_dir, 
SEND_REMOTING_FILE_SCRIPT_NAME)
+    command = os.path.join(self.shared_state.script_dir, 
self.SEND_REMOTING_FILE_SCRIPT_NAME)
+    psr = PSR(command, self.host, self.host_log, params="{0} {1} 
{2}".format(self.host, fileToCopy, target))
+    result = psr.run()
+    self.host_log.write("\n")
+    return result
+
+  def copyChocolateyConfig(self):
+    # Copying chocolatey.config file
+    fileToCopy = os.path.join(os.environ[self.CHOCOLATEY_INSTALL_VAR_NAME], 
self.CHOCOLATEY_CONFIG_DIR, self.CHOCOLATEY_CONFIG_FILENAME)
+    target = os.path.join(self.getTempFolder(), 
self.CHOCOLATEY_CONFIG_FILENAME)
+    self.host_log.write("==========================\n")
+    self.host_log.write("Copying chocolatey config file...")
+    command = os.path.join(self.shared_state.script_dir, 
self.SEND_REMOTING_FILE_SCRIPT_NAME)
     psr = PSR(command, self.host, self.host_log, params="{0} {1} 
{2}".format(self.host, fileToCopy, target))
     result = psr.run()
     self.host_log.write("\n")
     return result
 
+  def configureChocolatey(self):
+    self.host_log.write("==========================\n")
+    self.host_log.write("Running configure chocolatey script...")
+    tmpConfig = os.path.join(self.getTempFolder(), 
self.CHOCOLATEY_CONFIG_FILENAME)
+    command = os.path.join(self.shared_state.script_dir, 
self.CONFIGURE_CHOCOLATEY_SCRIPT_NAME)
+    psr = PSR(command, self.host, self.host_log, params="{0} 
{1}".format(self.host, tmpConfig))
+    result = psr.run()
+    self.host_log.write("\n")
+    return result
+
   def getRunSetupCommand(self, expected_hostname):
     setupFile = os.path.join(self.getTempFolder(), self.SETUP_SCRIPT_FILENAME)
     passphrase = os.environ[AMBARI_PASSPHRASE_VAR_NAME]
@@ -316,7 +343,7 @@ class BootstrapWindows(Bootstrap):
   def runSetupAgent(self):
     self.host_log.write("==========================\n")
     self.host_log.write("Running setup agent script...")
-    command = os.path.join(self.shared_state.script_dir, 
RUN_REMOTING_SCRIPT_NAME)
+    command = os.path.join(self.shared_state.script_dir, 
self.RUN_REMOTING_SCRIPT_NAME)
     psr = PSR(command, self.host, self.host_log, params="{0} 
\"{1}\"".format(self.host, self.getRunSetupCommand(self.host)))
     retcode = psr.run()
     self.host_log.write("\n")
@@ -329,6 +356,8 @@ class BootstrapWindows(Bootstrap):
     action_queue = [self.createTargetDir,
                     self.copyBootstrapArchive,
                     self.unzippingBootstrapArchive,
+                    self.copyChocolateyConfig,
+                    self.configureChocolatey,
                     self.runSetupAgent
     ]
     # Execution of action queue

http://git-wip-us.apache.org/repos/asf/ambari/blob/1345ec71/ambari-server/src/main/python/setupAgent.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/setupAgent.py 
b/ambari-server/src/main/python/setupAgent.py
index 7a8d545..38f353f 100755
--- a/ambari-server/src/main/python/setupAgent.py
+++ b/ambari-server/src/main/python/setupAgent.py
@@ -38,7 +38,9 @@ if OSCheck.is_windows_family():
 AMBARI_PASSPHRASE_VAR = "AMBARI_PASSPHRASE"
 PROJECT_VERSION_DEFAULT = "DEFAULT"
 
-AMBARI_AGENT_INSTALL_SYMLINK = "C:\\ambari\\ambari-agent"
+INSTALL_DRIVE =  os.path.splitdrive(__file__.replace('/', os.sep))[0]
+AMBARI_INSTALL_ROOT = os.path.join(INSTALL_DRIVE, os.sep, "ambari")
+AMBARI_AGENT_INSTALL_SYMLINK = os.path.join(AMBARI_INSTALL_ROOT, 
"ambari-agent")
 
 def _ret_init(ret):
   if not ret:
@@ -124,7 +126,8 @@ def installAgent(projectVersion, ret=None):
     # add * to end of version in case of some test releases
     Command = ["apt-get", "install", "-y", "--allow-unauthenticated", 
"ambari-agent=" + projectVersion + "*"]
   elif OSCheck.is_windows_family():
-    Command = ["cmd", "/c", "choco", "install", "-y", "ambari-agent", 
"--version=" + projectVersion]
+    packageParams = "/AmbariRoot:" + AMBARI_INSTALL_ROOT
+    Command = ["cmd", "/c", "choco", "install", "-y", "ambari-agent", 
"--version=" + projectVersion, "--params=\"" + packageParams + "\""]
   else:
     Command = ["yum", "-y", "install", "--nogpgcheck", "ambari-agent-" + 
projectVersion]
   return execOsCommand(Command, tries=3, try_sleep=10, ret=ret)

http://git-wip-us.apache.org/repos/asf/ambari/blob/1345ec71/ambari-server/src/main/windows/psremoting/Configure-Chocolatey.ps1
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/windows/psremoting/Configure-Chocolatey.ps1 
b/ambari-server/src/main/windows/psremoting/Configure-Chocolatey.ps1
new file mode 100644
index 0000000..a9018ea
--- /dev/null
+++ b/ambari-server/src/main/windows/psremoting/Configure-Chocolatey.ps1
@@ -0,0 +1,45 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# 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
+
+[CmdletBinding()]
+param (
+    [Parameter(Mandatory=$true)]
+    [string] $ComputerName,
+    [Parameter(Mandatory=$true)]
+    [string] $Path
+)
+
+function ConfigureChocolatey {
+  $ret = Invoke-Command -ComputerName $ComputerName -ScriptBlock {
+    try {
+      Write-Host "Configuring chocolatey"
+      $target = $Env:ChocolateyInstall + "\config\chocolatey.config"
+      $out = Move-Item -Path $args[0] -Destination $target -Force
+      $acl = Get-Acl $target
+      $ar = New-Object 
system.security.accesscontrol.filesystemaccessrule("Users","FullControl","Allow")
+      $acl.SetAccessRule($ar)
+      Set-Acl $target $acl
+      Write-Host "Configured chocolatey successfully"
+    } catch {
+      Write-Host $_.Exception.Message
+      Write-Host $_.Exception.ItemName
+      return -1
+    }
+    return 0
+  } -ArgumentList $Path
+  return $ret
+}
+$status = Invoke-Expression "ConfigureChocolatey"
+[environment]::exit($status)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/1345ec71/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index d9600a5..108db64 100644
--- a/pom.xml
+++ b/pom.xml
@@ -261,6 +261,7 @@
             
<exclude>ambari-metrics/ambari-metrics-host-monitoring/conf/windows/metric_groups.conf</exclude>
             
<exclude>contrib/addons/test/dataServices/jmx/data/cluster_configuration.json.nohbase</exclude>
             <exclude>contrib/ambari-scom/msi/src/GUI_Ambari.sln</exclude>
+            
<exclude>contrib/fast-hdfs-resource/dependency-reduced-pom.xml</exclude>
             <exclude>version</exclude>
             <!--IDE and GIT files-->
             <exclude>**/.idea/</exclude>

Reply via email to