Registering multiple roles using Tentacle.exe causes error

I have a machine that is part of more than 1 role.
If I call the register-with command with 1 role everything works fine. However, if I call it with 2 roles, I get an error:

Error: Unrecognized command line arguments: --environment ‘Sandbox’ --role ‘WebClient’ --role ‘US-East-Datacenter’

How do I register a machine with multiple roles / environments using tentacle.exe?

Here is the line that fails:
.\tentacle.exe register-with --instance $instanceId --server $octopusServerUrl --environment ‘Sandbox’ --role ‘WebClient’ --role ‘US-East-Datacenter’ --name $instanceId --publicHostName $ipAddress --apiKey $apiKey --comms-style TentaclePassive --force --console | Write-Host

Hi Doron,

Thanks for getting in touch! We can’t replicate this. So a few questions.
Can we have a copy of the full PowerShell script? What version of Tentacle are you running?
What environment is it being run on?

Our hunch is PS is forcing it to load over two lines.

All these things should help us to replicate it correctly.
Vanessa

Hi Vanessa

I think that your assumption is correct.

If I run this command, registration succeeds:
.\tentacle.exe register-with --instance $instanceId --server $octopusServerUrl --environment Sandbox --role WebClient --role ‘US-East-Datacenter’ --name $instanceId --publicHostName $ipAddress --apiKey $apiKey --comms-style TentaclePassive --force --console | Write-Host

However I need to pass the roles and environment as parameters, so this command fails:

$envExp="–environment ‘Sandbox’"
$roleExp=" --role ‘WebClient’ --role ‘US-East-Datacenter’"
tentacle.exe register-with --instance $instanceId --server $octopusServerUrl $envExp $roleExp --name $instanceId --publicHostName $ipAddress --apiKey $apiKey --comms-style entaclePassive --force --console | Write-Host

I guess that it is because the $envExp and $roleExp contains the property name and value and obviously powershell doesn’t handle this well.
Do you know how I can fix this?

I am using the latest Tentacle version, it is downloaded as part of the script.

Thanks,
Doron.

Hi,

I managed to solve my problem using Invoke-Expression

$registerExp = “.\tentacle.exe register-with --instance $instanceId --server $octopusServerUrl $envExp $roleExp --name $instanceId --publicHostName $ipAddress --apiKey $apiKey --comms-style entaclePassive --force --console | Write-Host”
Invoke-Expression $registerExp

This worked !

If we are on the subject already, have you come up with a way to unregister machines easily when AWS instances go down?
This is important for us because we use autoscale.

Thanks.
Doron.

From: Doron Neumann
Sent: Thursday, October 30, 2014 10:33
To: 'Vanessa Love’
Subject: RE: Registering multiple roles using Tentacle.exe causes error [Problems #26302]

Hi Vanessa

I think that your assumption is correct.

If I run this command, registration succeeds:
.\tentacle.exe register-with --instance $instanceId --server $octopusServerUrl --environment Sandbox --role WebClient --role ‘US-East-Datacenter’ --name $instanceId --publicHostName $ipAddress --apiKey $apiKey --comms-style TentaclePassive --force --console | Write-Host

However I need to pass the roles and environment as parameters, so this command fails:

$envExp="–environment ‘Sandbox’"
$roleExp=" --role ‘WebClient’ --role ‘US-East-Datacenter’"
tentacle.exe register-with --instance $instanceId --server $octopusServerUrl $envExp $roleExp --name $instanceId --publicHostName $ipAddress --apiKey $apiKey --comms-style entaclePassive --force --console | Write-Host

I guess that it is because the $envExp and $roleExp contains the property name and value and obviously powershell doesn’t handle this well.
Do you know how I can fix this?

I am using the latest Tentacle version, it is downloaded as part of the script.

Thanks,
Doron.

Hi Doron,

I am glad you got this working.
For the unregister, do you know on the server you are about to take it down?
We have a deregister-from command in tentacle.exe

Vanessa

Hi,

The command seems to be unsupported.
PS C:\Users\Administrator>
PS C:\Users\Administrator> $apiKey= "API-XXXXXXXXXXXXXXXXXXXXXX"
PS C:\Users\Administrator> $octopusServerUrl = "https://octopus.gameffectiveapplication.com/"
PS C:\Users\Administrator> $webClient = new-object Net.WebClient
PS C:\Users\Administrator> $instanceId = $webClient.DownloadString(“http://169.254.169.254/latest/meta-data/instance-id”)
PS C:\Users\Administrator>
PS C:\Users\Administrator> C:\Users\ADMINI~1\AppData\Local\Temp\octo.exe deregister-from --instanceId $instanceId --apiKey $apiKey --server=$octopusServerUrl
Octopus Deploy Command Line Tool, version 2.5.10.39

Error: Unrecognized command ‘deregister-from’

Our server version is Octopus Deploy 2.5.9.555

Thanks,
Doron.

Hi Doron,

The command is only available in tentacle.exe not octo.exe.

Vanessa

Hi Vanessa,

My bad.
I wanted to thank you for great support and AMAZING PRODUCT.
I have been searching for a number of years for such a product which will enable me to easily manage deployment and update of Windows services.
All other tools I ran into gave a partial solution at best and were unreliable.
OctopusDeploy product is truly the best solution out there for deployment of cloud software both Web & Windows Service in a Windows environment.

Thanks,

Doron Neumann

image001.png

Hi Doron,

I shared your words with the team this morning to start the week of positive!

Vanessa