New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SqlAG & SqlAGReplica: Remove parameter SQLServerNetName #924

Closed
johlju opened this Issue Dec 1, 2017 · 10 comments

Comments

Projects
None yet
4 participants
@johlju
Contributor

johlju commented Dec 1, 2017

Details of the scenario you tried and the problem that is occurring:
The work renaming parameters in issue #308 does not mention the parameter
SQLServerNetName in the resource SqlAG.

[Read, Description("Gets the hostname the SQL Server instance is listening on.")] String SQLServerNetName;

I suggest we rename it to NetName.

The DSC configuration that is using the resource (as detailed as possible):
n/a

Version of the Operating System, SQL Server and PowerShell the DSC Target Node is running:
n/a

What module (SqlServer or SQLPS) and which version of the module the DSC Target Node is running:
n/a

Version of the DSC module you're using, or 'dev' if you're using current dev branch:
Dev

@johlju johlju added the discussion label Dec 1, 2017

@johlju

This comment has been minimized.

Show comment
Hide comment
@johlju

johlju Dec 1, 2017

Contributor

@randomnote1 @nabrond next one, what do you think?

Contributor

johlju commented Dec 1, 2017

@randomnote1 @nabrond next one, what do you think?

@johlju

This comment has been minimized.

Show comment
Hide comment
@johlju

johlju Dec 1, 2017

Contributor

I'm open for other names. Maybe NetServerName would be more appropriate?

Contributor

johlju commented Dec 1, 2017

I'm open for other names. Maybe NetServerName would be more appropriate?

@randomnote1

This comment has been minimized.

Show comment
Hide comment
@randomnote1

randomnote1 Dec 1, 2017

Contributor

NetName is the property off of the server object that is used. This is either the node name or the virtual computer object name of the FCI. ServerNetName would make sense to me.

Contributor

randomnote1 commented Dec 1, 2017

NetName is the property off of the server object that is used. This is either the node name or the virtual computer object name of the FCI. ServerNetName would make sense to me.

@johlju

This comment has been minimized.

Show comment
Hide comment
@johlju

johlju Dec 1, 2017

Contributor

ServerNetName works for me.

Contributor

johlju commented Dec 1, 2017

ServerNetName works for me.

@nabrond

This comment has been minimized.

Show comment
Hide comment
@nabrond

nabrond Dec 2, 2017

Contributor

Should we drop the parameter all together? It looks like it is only used in the Get-TargetResource and Test-TargetResource functions and may be a duplicate of EndpointHostName.

Contributor

nabrond commented Dec 2, 2017

Should we drop the parameter all together? It looks like it is only used in the Get-TargetResource and Test-TargetResource functions and may be a duplicate of EndpointHostName.

@johlju

This comment has been minimized.

Show comment
Hide comment
@johlju

johlju Dec 5, 2017

Contributor

I agree, I think doing the below would result in the same thing, and we could remove the parameter.
@randomnote1 What do think? Either that, or is it a bug that we don't return the value the user set in the parameter EndPointHostName from the Get-TargetResource function?

I'm thinking of the above change, since the Set-TargetResource function already is using NetName property for the parameter EndpointHostname if it is not set.

if ( -not $EndpointHostName )
{
$EndpointHostName = $serverObject.NetName
}

So, changing this row in Get-TargetResource.

$alwaysOnAvailabilityGroupResource.SQLServerNetName = $serverObject.NetName

Into

$alwaysOnAvailabilityGroupResource.EndpointHostName = $serverObject.NetName

and changing this code block in Test-TargetResource function

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

into

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

johlju commented Dec 5, 2017

I agree, I think doing the below would result in the same thing, and we could remove the parameter.
@randomnote1 What do think? Either that, or is it a bug that we don't return the value the user set in the parameter EndPointHostName from the Get-TargetResource function?

I'm thinking of the above change, since the Set-TargetResource function already is using NetName property for the parameter EndpointHostname if it is not set.

if ( -not $EndpointHostName )
{
$EndpointHostName = $serverObject.NetName
}

So, changing this row in Get-TargetResource.

$alwaysOnAvailabilityGroupResource.SQLServerNetName = $serverObject.NetName

Into

$alwaysOnAvailabilityGroupResource.EndpointHostName = $serverObject.NetName

and changing this code block in Test-TargetResource function

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

into

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

This comment has been minimized.

Show comment
Hide comment
@johlju

johlju Dec 5, 2017

Contributor

In the Get-TargetResource function we could also return the value of the EndpointHostName if the parameter is set. If it is not set then we return $serverObject.NetName (the above code).

Contributor

johlju commented Dec 5, 2017

In the Get-TargetResource function we could also return the value of the EndpointHostName if the parameter is set. If it is not set then we return $serverObject.NetName (the above code).

@randomnote1

This comment has been minimized.

Show comment
Hide comment
@randomnote1

randomnote1 Dec 5, 2017

Contributor

Well, I'm not entirely sure why I chose to create a read-only property for $serverObject.NetName. I'm in favor of using $EndpointHostName and dropping $SQLServerNetName.

Contributor

randomnote1 commented Dec 5, 2017

Well, I'm not entirely sure why I chose to create a read-only property for $serverObject.NetName. I'm in favor of using $EndpointHostName and dropping $SQLServerNetName.

@johlju johlju changed the title from SqlAG: Rename parameter SQLServerNetName to SqlAG & SqlAGReplica: Rename parameter SQLServerNetName Dec 7, 2017

@johlju

This comment has been minimized.

Show comment
Hide comment
@johlju

johlju Dec 7, 2017

Contributor

@randomnote1 The same logic seem to exist in SqlAgReplica as well. So changing that as well.

Working on this now.

Contributor

johlju commented Dec 7, 2017

@randomnote1 The same logic seem to exist in SqlAgReplica as well. So changing that as well.

Working on this now.

@johlju johlju added in progress and removed help wanted labels Dec 7, 2017

@johlju johlju changed the title from SqlAG & SqlAGReplica: Rename parameter SQLServerNetName to SqlAG & SqlAGReplica: Remove parameter SQLServerNetName Dec 7, 2017

johlju added a commit to johlju/SqlServerDsc that referenced this issue Dec 7, 2017

Changes to SqlAG
- The read-only property SQLServerNetName was removed in favor of EndpointHostName (issue PowerShell#924).
  Get-TargetResource will return the value of property NetName as the default value if
  EndpointHostName parameter is not assigned a value.

johlju added a commit to johlju/SqlServerDsc that referenced this issue Dec 7, 2017

Changes to SqlAGReplica
- The read-only property SQLServerNetName was removed in favor of EndpointHostName (issue PowerShell#924).
  Get-TargetResource will return the value of property NetName as the default value if
  EndpointHostName parameter is not assigned a value.
@randomnote1

This comment has been minimized.

Show comment
Hide comment
@randomnote1

randomnote1 Dec 7, 2017

Contributor

That makes sense. Thanks!

Contributor

randomnote1 commented Dec 7, 2017

That makes sense. Thanks!

@johlju johlju closed this in #938 Dec 8, 2017

johlju added a commit that referenced this issue Dec 8, 2017

SqlAg & SqlReplica: Removes SQLServerNetName in favor of EndpointHost…
…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.

@vors vors removed the high priority label Dec 8, 2017

@johlju johlju removed the in progress label Dec 9, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment