Why can't I use OriginalInstalledPath?


As part of my deploys, I have a powershell script that I’ve placed in the package directory (think /Production/packageName) that I’m trying to run after the nuget package is deployed (a website). I’ve create the following powershell script to run, but I’m getting the error:

Get-Item : Cannot bind argument to parameter 'Path' because it is null.
Error    14:10:09
At C:\Windows\system32\config\systemprofile\AppData\Local\Tentacle\Temp\43c63ba
Error    14:10:09
1-1e3b-4c29-97a2-e3491db9939a.ps1:7 char:18
Error    14:10:09
+ $dir = (get-item ($installedPath)).Parent
Error    14:10:09
+                  ~~~~~~~~~~~~~~~~
Error    14:10:09
    + CategoryInfo          : InvalidData: (:) [Get-Item], ParentContainsError 
Error    14:10:09
Error    14:10:09
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,M 
Error    14:10:09
Info    14:10:09
PowerShell exit code: 1
Fatal    14:10:09
PowerShell script returned a non-zero exit code: 1
Tentacle version
$installedPath = $OctopusParameters['Octopus.Tentacle.PreviousInstallation.OriginalInstalledPath']
$dir = (get-item ($installedPath)).Parent
Set-Location -Path ($dir.FullName)

# Run the script

Any ideas? The error makes me think that $installedPath is null or empty but is $OctopusParameters[‘Octopus.Tentacle.PreviousInstallation.OriginalInstalledPath’] the right parameter I should be using? If so, why is it empty?

Hi there,

Thanks for reaching out! Judging be the error you are getting, it seems like the variable $OctopusParameters['Octopus.Tentacle.PreviousInstallation.OriginalInstalledPath'] does not hold a value at the moment of that deployment. The scenario where that variable might be empty, is when the previous deployment was for a package that was already deployed on that machine and you didnt had the “Force deployment” setting enabled. On that case you basically did not deploy anything, hence that variable would be empty during the next deployment.

Could you running a deployment with a powershell step that only has $OctopusParameters['Octopus.Tentacle.PreviousInstallation.OriginalInstalledPath']? This way we can know if that variable holds or not a value.

Before you run this deployment, please enable the debugging variables on your project and then send us your deployment raw log. This will help us know the exact value of each variable during your deployment.