Skip to content

RDSessionDeployment: GetCurrentState should return $properties.ConnectionBroker when deployment exists #153

@coderabbitai

Description

@coderabbitai

Summary

In the RDSessionDeployment class-based resource (source/Classes/020.RDSessionDeployment.ps1), the GetCurrentState() method currently determines the ConnectionBroker value by filtering the results of Get-RDServer for the RDS-CONNECTION-BROKER role:

ConnectionBroker = ($deployed.Where({ $_.Roles -contains 'RDS-CONNECTION-BROKER' })).Server

However, if Get-RDServer returns results (i.e. a deployment exists), the ConnectionBroker should simply be set to $properties.ConnectionBroker — since the query was already scoped to that broker and a successful response confirms it is present.

In HA deployments, filtering for RDS-CONNECTION-BROKER could also return multiple values, which would be incompatible with the [System.String] type of the ConnectionBroker property.

Expected Behaviour

When Get-RDServer returns results, ConnectionBroker in the returned hashtable should be set to $properties.ConnectionBroker.

Backlinks

Raised by @dan-hughes.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions