Skip to content

Commit

Permalink
Fix issue finding matching machine from server (#243)
Browse files Browse the repository at this point in the history
The `cTentacleAgent::Get-TentacleThumbprint` function was not returning the thumbprint, so it was matching other machines (targets) on the server that didn't have a thumbprint property (ie, cloud regions)

This commit changes the data setup so that there are other machines, causing the same issue as reported in the attached issues

Fixes #246
Fixes #242
  • Loading branch information
matt-richardson authored Apr 12, 2020
1 parent 5063e64 commit 0d25d9d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions OctopusDSC/OctopusDSCHelpers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ function Invoke-TentacleCommand ($arguments) {
throw "Command returned exit code $LASTEXITCODE. Aborting."
}
Write-Verbose "done."
return $output
}

function Write-CommandOutput {
Expand Down
4 changes: 2 additions & 2 deletions Tests/Scenarios/Tentacle_Scenario_01_Install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Configuration Tentacle_Scenario_01_Install
# Registration - all parameters required
ApiKey = $ApiKey;
OctopusServerUrl = $OctopusServerUrl;
Environments = $Environments;
Environments = "Env2";
Roles = $Roles;

# Optional settings
Expand Down Expand Up @@ -130,7 +130,7 @@ Configuration Tentacle_Scenario_01_Install
PublicHostNameConfiguration = "ComputerName"
TentacleHomeDirectory = "C:\Octopus\WorkerTentacleHome"

WorkerPools = @("Default Worker Pool")
WorkerPools = @("Secondary Worker Pool")
}

# load the credential for said user
Expand Down
3 changes: 2 additions & 1 deletion Tests/Scenarios/Tentacle_Scenario_02_Remove.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Configuration Tentacle_Scenario_02_Remove
# Registration - all parameters required
ApiKey = $ApiKey;
OctopusServerUrl = $OctopusServerUrl;
Environments = "Env2";
Roles = $Roles;

# Optional settings
Expand Down Expand Up @@ -127,7 +128,7 @@ Configuration Tentacle_Scenario_02_Remove
PublicHostNameConfiguration = "ComputerName"
TentacleHomeDirectory = "C:\Octopus\WorkerTentacleHome"

WorkerPools = @("Default Worker Pool")
WorkerPools = @("Secondary Worker Pool")
}


Expand Down
2 changes: 1 addition & 1 deletion Tests/Spec/tentacle_scenario_01_install_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
it { should be_registered_with_the_server }
it { should be_online }
it { should be_polling_tentacle }
it { should be_in_environment('The-Env') }
it { should be_in_environment('Env2') }
it { should have_role('Test-Tentacle') }
it { should have_display_name("#{ENV['COMPUTERNAME']}_PollingTentacle") }
it { should have_policy('Default Machine Policy') }
Expand Down
8 changes: 8 additions & 0 deletions Tests/configure-octopus-for-tentacle-tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ try
#create an environment for the tentacles to go into
$environmentEditor = $repository.Environments.CreateOrModify("The-Env")
$environment = $environmentEditor.Instance
$repository.Environments.CreateOrModify("Env2") | Out-Null

#create a project
$projectGroup = $repository.ProjectGroups.Get("ProjectGroups-1")
Expand Down Expand Up @@ -63,6 +64,13 @@ try
$policyResource.Description = "Test Machine Policy"
$repository.MachinePolicies.Create($policyResource) | Out-Null

#ensure we have a worker pool
$repository.WorkerPools.CreateOrModify("Secondary Worker Pool") #| Out-Null

#ensure we have a cloud region (ie, something without a thumbprint, to catch null thumbprint errors)
$cloudRegionEndpoint = New-Object Octopus.Client.Model.Endpoints.CloudRegionEndpointResource
$repository.Machines.CreateOrModify("My Cloud Region", $cloudRegionEndpoint, @($environment), @("cloud-region")) | Out-Null

$certificate = Invoke-RestMethod "$OctopusURI/api/configuration/certificates/certificate-global?apikey=$($createApiKeyResult.ApiKey)"
$content = @{
"OctopusServerUrl" = $OctopusURI;
Expand Down

0 comments on commit 0d25d9d

Please sign in to comment.