Skip to content

Commit

Permalink
Added policy to register worker sections (#278)
Browse files Browse the repository at this point in the history
* Added policy to register worker sections

* Added requested test.

* Apply suggestions from code review

Co-authored-by: Matt Richardson <[email protected]>
  • Loading branch information
twerthi and matt-richardson authored Apr 7, 2021
1 parent 034e730 commit fc0eef8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
19 changes: 16 additions & 3 deletions OctopusDSC/DSCResources/cTentacleAgent/cTentacleAgent.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,8 @@ function Set-TargetResource {
-customPublicHostName $customPublicHostName `
-listenPort $listenPort `
-tentacleCommsPort $tentacleCommsPort `
-space $space
-space $space `
-Policy $Policy
} elseif (![string]::IsNullOrEmpty($Environments) -and ![string]::IsNullOrEmpty($Roles)) {
Register-Tentacle -name $Name `
-apiKey $ApiKey `
Expand Down Expand Up @@ -958,7 +959,8 @@ function New-Tentacle {
-publicHostNameConfiguration $publicHostNameConfiguration `
-listenPort $listenPort `
-tentacleCommsPort $tentacleCommsPort `
-space $space
-space $space `
-Policy $Policy
} elseif (![string]::IsNullOrEmpty($Environments) -and ![string]::IsNullOrEmpty($Roles)) {
Write-Verbose "Registering Tentacle"
Register-Tentacle -name $name `
Expand Down Expand Up @@ -1116,7 +1118,12 @@ function Add-TentacleToWorkerPool {
[AllowNull()]
[AllowEmptyString()]
[String]
$Space
$Space,
[Parameter(Mandatory = $false)]
[AllowNull()]
[AllowEmptyString()]
[String]
$Policy
)
if ($listenPort -eq 0) {
$listenPort = 10933
Expand Down Expand Up @@ -1164,6 +1171,12 @@ function Add-TentacleToWorkerPool {
)
}

if(![string]::IsNullOrWhiteSpace($Policy)) {
$argumentList += @(
"--policy", "$Policy"
)
}

foreach ($workerPool in $workerPools) {
$argumentList += @(
"--workerpool", $workerPool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ return @(
"new-certificate --instance Tentacle --console",
"configure --instance Tentacle --home C:\Octopus --app C:\Applications --console --port 10935",
"service --install --instance Tentacle --console --reconfigure --username Admin --password S3cur3P4ssphraseHere!",
"register-worker --instance Tentacle --server http://localhost:81 --name My Worker --force --apiKey API-1234 --comms-style TentaclePassive --publicHostName mytestserver.local --workerpool NodeJSWorker"
"register-worker --instance Tentacle --server http://localhost:81 --name My Worker --force --apiKey API-1234 --comms-style TentaclePassive --publicHostName mytestserver.local --policy My machine policy --workerpool NodeJSWorker"
)
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ return @{
DefaultApplicationDirectory = "C:\Applications"
TentacleHomeDirectory = "C:\Octopus"
WorkerPools = @("NodeJSWorker")
Policy = "My machine policy"
}

0 comments on commit fc0eef8

Please sign in to comment.