Skip to content

Commit

Permalink
SqlAg & SqlReplica: Removes SQLServerNetName in favor of EndpointHost…
Browse files Browse the repository at this point in the history
…Name (#938)

- Changes to SqlAG
  - BREAKING CHANGE: The read-only property SQLServerNetName was removed in favour of
    EndpointHostName (issue #924). Get-TargetResource will now return the value of property
    NetName for the property EndpointHostName.
- Changes to SqlAGReplica
  - BREAKING CHANGE: The read-only property SQLServerNetName was removed in favour of
    EndpointHostName (issue #924). Get-TargetResource will now return the value of property
    NetName for the property EndpointHostName.
  • Loading branch information
johlju committed Dec 8, 2017
1 parent 17a5698 commit 972ddff
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 12 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Expand Up @@ -21,6 +21,10 @@
- BREAKING CHANGE: Parameters SQLServer and SQLInstanceName has been renamed
to ServerName and InstanceName respectively
([issue #308](https://github.com/PowerShell/SqlServerDsc/issues/308)).
- BREAKING CHANGE: The read-only property SQLServerNetName was removed in favor
of EndpointHostName ([issue #924](https://github.com/PowerShell/SqlServerDsc/issues/924)).
Get-TargetResource will now return the value of property [NetName](https://technet.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.server.netname(v=sql.105).aspx)
for the property EndpointHostName.
- Changes to SqlAGDatabase
- BREAKING CHANGE: Parameters SQLServer and SQLInstanceName has been renamed
to ServerName and InstanceName respectively
Expand All @@ -37,6 +41,10 @@
- BREAKING CHANGE: Parameters PrimaryReplicaSQLServer and PrimaryReplicaSQLInstanceName
has been renamed to PrimaryReplicaServerName and PrimaryReplicaInstanceName
respectively ([issue #922](https://github.com/PowerShell/SqlServerDsc/issues/922)).
- BREAKING CHANGE: The read-only property SQLServerNetName was removed in favor
of EndpointHostName ([issue #924](https://github.com/PowerShell/SqlServerDsc/issues/924)).
Get-TargetResource will now return the value of property [NetName](https://technet.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.server.netname(v=sql.105).aspx)
for the property EndpointHostName.
- Changes to SqlAlwaysOnService
- BREAKING CHANGE: Parameters SQLServer and SQLInstanceName has been renamed
to ServerName and InstanceName respectively
Expand Down
4 changes: 2 additions & 2 deletions DSCResources/MSFT_SqlAG/MSFT_SqlAG.psm1
Expand Up @@ -76,7 +76,7 @@ function Get-TargetResource
$alwaysOnAvailabilityGroupResource.HealthCheckTimeout = $availabilityGroup.HealthCheckTimeout
$alwaysOnAvailabilityGroupResource.EndpointURL = $availabilityGroup.AvailabilityReplicas[$serverObject.DomainInstanceName].EndpointUrl
$alwaysOnAvailabilityGroupResource.EndpointPort = $endpointPort
$alwaysOnAvailabilityGroupResource.SQLServerNetName = $serverObject.NetName
$alwaysOnAvailabilityGroupResource.EndpointHostName = $serverObject.NetName
$alwaysOnAvailabilityGroupResource.Version = $sqlMajorVersion

# Add properties that are only present in SQL 2016 or newer
Expand Down Expand Up @@ -700,7 +700,7 @@ function Test-TargetResource

if ( -not $EndpointHostName )
{
$EndpointHostName = $getTargetResourceResult.SQLServerNetName
$EndpointHostName = $getTargetResourceResult.EndpointHostName
}

# Verify the hostname in the endpoint URL is correct
Expand Down
1 change: 0 additions & 1 deletion DSCResources/MSFT_SqlAG/MSFT_SqlAG.schema.mof
Expand Up @@ -20,7 +20,6 @@ class MSFT_SqlAG : OMI_BaseResource
[Write, Description("Specifies that the resource will only determine if a change is needed if the target node is the active host of the SQL Server Instance.")] Boolean ProcessOnlyOnActiveNode;
[Read, Description("Gets the Endpoint URL of the availability group replica endpoint.")] String EndpointUrl;
[Read, Description("Gets the port the database mirroring endpoint is listening on.")] UInt32 EndpointPort;
[Read, Description("Gets the hostname the SQL Server instance is listening on.")] String SQLServerNetName;
[Read, Description("Gets the major version of the SQL Server instance.")] UInt32 Version;
[Read, Description("Determines if the current node is actively hosting the SQL Server instance.")] Boolean IsActiveNode;
};
4 changes: 2 additions & 2 deletions DSCResources/MSFT_SqlAGReplica/MSFT_SqlAGReplica.psm1
Expand Up @@ -71,7 +71,7 @@ function Get-TargetResource
ServerName = $ServerName
InstanceName = $InstanceName
EndpointPort = $endpointPort
SQLServerNetName = $serverObject.NetName
EndpointHostName = $serverObject.NetName
}

# Get the availability group
Expand Down Expand Up @@ -672,7 +672,7 @@ function Test-TargetResource

if ( -not $EndpointHostName )
{
$EndpointHostName = $getTargetResourceResult.SQLServerNetName
$EndpointHostName = $getTargetResourceResult.EndpointHostName
}

# Verify the hostname in the endpoint URL is correct
Expand Down
Expand Up @@ -19,6 +19,5 @@ class MSFT_SqlAGReplica : OMI_BaseResource
[Write, Description("Specifies that the resource will only determine if a change is needed if the target node is the active host of the SQL Server instance.")] Boolean ProcessOnlyOnActiveNode;
[Read, Description("Output the network port the endpoint is listening on. Used by Get-TargetResource.")] Uint16 EndpointPort;
[Read, Description("Output the endpoint URL of the Availability Group Replica. Used by Get-TargetResource.")] String EndpointUrl;
[Read, Description("Output the NetName property from the SQL Server object. Used by Get-TargetResource.")] String SqlServerNetName;
[Read, Description("Determines if the current node is actively hosting the SQL Server instance.")] Boolean IsActiveNode;
};
4 changes: 0 additions & 4 deletions README.md
Expand Up @@ -262,8 +262,6 @@ It will also manage the Availability Group replica on the specified node.
availability group replica endpoint.
* **`[Uint32]` EndpointPort** _(Read)_: Gets the port the database mirroring
endpoint is listening on
* **`[String]` SQLServerNetName** _(Read)_: Gets the hostname the SQL Server
instance is listening on.
* **`[Uint32]` Version** _(Read)_: Gets the major version of the SQL Server
instance.
* **`[Boolean]` IsActiveNode** _(Read)_: Determines if the current node is
Expand Down Expand Up @@ -391,8 +389,6 @@ Always On Availability Group Replica.
listening on. Used by Get-TargetResource.
* **`[String]` EndpointUrl** _(Read)_: Output the endpoint URL of the
Availability Group Replica. Used by Get-TargetResource.
* **`[String]` SQLServerNetName** _(Read)_: Output the NetName property from the
SQL Server object.
* **`[Boolean]` IsActiveNode** _(Read)_: Determines if the current node is
actively hosting the SQL Server instance.

Expand Down
4 changes: 2 additions & 2 deletions Tests/Unit/MSFT_SqlAGReplica.Tests.ps1
Expand Up @@ -567,7 +567,7 @@ try
$getTargetResourceResult.ReadOnlyRoutingList | Should -BeNullOrEmpty
$getTargetResourceResult.ServerName | Should -Be $mockServerName
$getTargetResourceResult.InstanceName | Should -Be $mockInstanceName
$getTargetResourceResult.SQLServerNetName | Should -Be $mockServerName
$getTargetResourceResult.EndpointHostName | Should -Be $mockServerName

Assert-MockCalled -CommandName Connect-SQL -Scope It -Times 1 -Exactly
}
Expand Down Expand Up @@ -595,7 +595,7 @@ try
$getTargetResourceResult.ReadOnlyRoutingList | Should -Be $mockServerName
$getTargetResourceResult.ServerName | Should -Be $mockServerName
$getTargetResourceResult.InstanceName | Should -Be $mockInstanceName
$getTargetResourceResult.SQLServerNetName | Should -Be $mockServerName
$getTargetResourceResult.EndpointHostName | Should -Be $mockServerName

Assert-MockCalled -CommandName Connect-SQL -Scope It -Times 1 -Exactly
}
Expand Down

0 comments on commit 972ddff

Please sign in to comment.