Tentacle not setting working directory

Hello,

We’ve observed on a new set of servers that the Tentacle is not setting the working directory before executing our Pre-Deploy script. This breaks the relative dot sourcing that we’re doing. i.e:

PreDeploy.ps1:

. “.\Deployment\Script.ps1”

Results in the error:

2015-02-06 20:42:46 INFO [PreDeploy Script] ERROR: : The term ‘.\Deployment\Script.ps1’ is not recognized as the name of a cmdlet,
2015-02-06 20:42:46 INFO [PreDeploy Script] ERROR: function, script file, or operable program. Check the spelling of the name, or
2015-02-06 20:42:46 INFO [PreDeploy Script] ERROR: if a path was included, verify that the path is correct and try again.

We’ve adding some logging to see that:

The value of $PSScriptRoot is: the expected working directory
The current working directory (determined by the command: Write-Host (Convert-Path .) is: C:\

So for some reason, on these machines, the Tentacle isn’t correctly setting the working directory. Hoping someone has encountered this before - we suspect permissions, configuration, etc. But so far we can’t see any differences between how the Tentacle is configured on these systems to others that don’t have this problem.

Thanks,

Joel

Sorry, forgot to add:

2015-02-06 20:42:45 DEBUG - Is 64-bit: True
2015-02-06 20:42:45 DEBUG - Service user name: octo_tentacle
2015-02-06 20:42:45 DEBUG - CLR version: 4.0.30319.18063
2015-02-06 20:42:45 DEBUG - Current directory: C:\Windows\system32
2015-02-06 20:42:45 DEBUG - OS version: Microsoft Windows NT 6.1.7601 Service Pack 1
2015-02-06 20:42:45 DEBUG - Tentacle version: 1.6.1.1718

Hi Joel,

Thanks for getting in touch. We haven’t heard of this happening before, but would it be possible to try restarting the Tentacle service on the machine, to see if that resolves it?

When we invoke PowerShell we do tell it which working directory to use. Is your Deploy.ps1 file at the root of the package?

Paul

Hi Paul,

Thanks for replying. We did try restarting … everything that could be restarted :slight_smile:. But in fact it’s looking more and more like we’ve encountered a devious permissions issue for a group of recently provisioned VMs.

I’ll get back in touch if we don’t hit pay dirt there.

Thanks again!

Joel

Hi again Paul,

Wanted to share that we’ve observed that Octopus will silently ignore errors that happen if the current directory cannot be changed (due to permissions, in our case). Since this leads to strange consequences, it would be useful to trigger a failure or at least a warning log.

Thanks,

Joel

From: Joel Skrepnek
Sent: Tuesday, February 10, 2015 9:17 AM
To: 'Paul Stovell’
Subject: RE: Tentacle not setting working directory [Problems #29876]

Hi Paul,

Thanks for replying. We did try restarting … everything that could be restarted :slight_smile:. But in fact it’s looking more and more like we’ve encountered a devious permissions issue for a group of recently provisioned VMs.

I’ll get back in touch if we don’t hit pay dirt there.

Thanks again!

Joel