Get the active directory of the current deployment?

I am Writing a simple PowerShell module to Enable/Disable a IIS node in our loadbalancers. I’m Writing these methods:

  • Get-WebNodeStatus
  • Enable-WebNode
  • Disable-Webnode

My idea is that when a new rolling deployment is run the above methods will be used in order to do one node at a time.
I want my script to be as generic as possible. So I need to find out where the previous deployment resides on disk.

I have seen two system variables to help me:

  • Octopus.Tentacle.PreviousInstallation.CustomInstallationDirectory
  • Octopus.Tentacle.PreviousInstallation.OriginalInstalledPath

Can I safely assume that the first one, CustomInstallationDirectory, always contains the path to the web root? Or do I need to check both variables? Why I am asking is because I want my script to handle projects with and without the CustominstallDirectory feature?

I am a newcomer to Octopus so pardon me if this is elementary! But I haven’t been able to figure out the best way to handle this.

Cheers,
Joakim

Hi Joakim,

Thanks for reaching out. Quite an advanced topic for a newcomer ;).

Yes, you can assume that CustomInstallationDirectory will always have the path where the package was installed on. If you don’t use a Custom Installation Directory, we still populate the variable CustomInstallationDirectory with the path where the package was installed on.

Hope that helps!

Dalmiro

Thanks, just what I needed to know!

/Joakim

Den 3 feb 2015 18:50 skrev Dalmiro Grañas tender2+d3f488253b@tenderapp.com: