anadimisra / biztalk-provisioner

Automated provisioner for BizTalk Server.
MIT License
0 stars 2 forks source link

provisioner script for tool installation #4

Closed vishagilityroots closed 7 years ago

vishagilityroots commented 7 years ago

after creating instance properly, a shell provisioner step should install puppet and other tools required for provisioning biztalk.

vishagilityroots commented 7 years ago

Downloading curl fails because it is trying to download securely:

PS C:\Users\vvenu3\work\biztalk-provisioner> $client.DownloadFile( $curlUri, 'cu
rl.zip')
Exception calling "DownloadFile" with "2" argument(s): "The request was
aborted: Could not create SSL/TLS secure channel."
At line:1 char:1
+ $client.DownloadFile( $curlUri, 'curl.zip')
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : WebException

There is a very nice blog here: https://blogs.technet.microsoft.com/bshukla/2010/04/12/ignoring-ssl-trust-in-powershell-system-net-webclient/

Essentially it says you can't just 'ignore SSL' in Powershell. Okay..... :(

vishagilityroots commented 7 years ago

aha! The solution is here.

You need to first determine the security implementation of the website and then set the SecurityProtocolType. i.e

PS C:\Users\vvenu3> [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
PS C:\Users\vvenu3> Invoke-WebRequest -Uri https://curl.haxx.se/download/curl-7.54.1.tar.gz -OutFile C:\curl.tar.gz
vishagilityroots commented 7 years ago

Silly error:

&7z e curl.zip `-o`"c:\program files\curl`" 

During repeated runs this will ask whether to overwrite. And I just can't figure out how to pass the -y flag to say "overwrite".

:exclamation: Right now calling this a known issue and moving on. The bootstrap script is not robust enough to handle provisioning of existing instances.

vishagilityroots commented 7 years ago

New problem: downloading puppet MSI file throws an error, but seems to continue downloading.

PS C:\Users\Administrator> & 'C:\Program Files\Curl\curl.exe' -# -G -k -L https://downloads.puppetlabs.com/windows/puppe
t-3.2.4.msi -o puppet-3.2.4.msi 2>&1
curl.exe :
At line:1 char:1
+ & 'C:\Program Files\Curl\curl.exe' -# -G -k -L https://downloads.puppetlabs.com/ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

##########                                                                14.9%
######################                                                    31.5%
###################################                                       48.9%
###############################################                           66.3%
############################################################              83.8%
######################################################################## 100.0%
PS C:\Users\Administrator>

Unfortunately since I have set $ErrorActionPreference = "Stop" i.e fail on error, this causes the script to stop.

Solution 1: didn't work

Solution: ignore the error and move on :smile: https://stackoverflow.com/a/2095623/682912

Update that didn't work, it still fails on error due to ErrorActionPreference.

Solution 2: Disable Fail-On-Error

$ErrorActionPreference = "Continue"
& 'C:\Program Files\Curl\curl.exe' -# -G -k -L https://downloads.puppetlabs.com/windows/puppet-3.2.4.msi -o puppet-3.2.4.msi 2>$null > "$log"
$ErrorActionPreference = "Stop"

And this worked :+1: Puppet is successfully installed!

vishagilityroots commented 7 years ago

Shell provisioners are verified working.