Skip to content
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

Cluster: Cluster created with path CN= is not idempotent #195

Open
jdwhited opened this issue Nov 5, 2018 · 6 comments
Open

Cluster: Cluster created with path CN= is not idempotent #195

jdwhited opened this issue Nov 5, 2018 · 6 comments
Labels
enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community.

Comments

@jdwhited
Copy link

jdwhited commented Nov 5, 2018

Details of the scenario you tried and the problem that is occurring

I created a cluster with a custom path for the CNO. Example:

Name = CN=mycluster,OU=ClusterOU,OU=Main,DC=example,DC=com

This actually worked great, but it is not idempotent. Even though the New-Cluster that the DSC calls allows for a custom path /name, the DSC doesn't expect that when calling the Test.

Verbose logs showing the problem

Error Message: PowerShell DSC resource MSFT_xCluster failed to execute Set-TargetResource functionality with error message: The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: There was an error adding node 'myserver' to the cluster
The computer 'myserver.example.com' is joined to a cluster

Suggested solution to the issue

There are multiple ways to handle this (including adding a path parameter), but from a coding perspective the easiest is to just check the $Name for a CN= prefix and pull out the actual cluster name. If there is no CN= prefix just use the name with the original intent:

       if ( $Name -match '^CN=' ) {
          $CN = $Name.split('{,}')
          $Name = $CN[0].split('{=}')[1]
        }

The DSC configuration that is used to reproduce the issue (as detailed as possible)

Configuration Example
{
    param(
        [Parameter(Mandatory = $true)]
        [PSCredential]
        $ActiveDirectoryAdministratorCredential
    )

    Import-DscResource -ModuleName xFailOverCluster

    Node localhost
    {

        xCluster CreateCluster
        {
            Name                          = 'CN=mycluster,OU=ClusterOU,OU=Main,DC=example,DC=com'
            StaticIPAddress               = '10.10.10.1'

            <#
                This user must have the permission to create the CNO (Cluster Name Object) in Active Directory,
                unless it is prestaged.
            #>
            DomainAdministratorCredential = $ActiveDirectoryAdministratorCredential
            
        }
    }
}

The operating system the target node is running

OsName : Microsoft Windows Server 2012 R2 Standard
OsOperatingSystemSKU : StandardServerEdition
OsArchitecture : 64-bit
WindowsBuildLabEx : 9600.19153.amd64fre.winblue_ltsb.180908-0600
OsLanguage : en-US
OsMuiLanguages : {en-US}

Version and build of PowerShell the target node is running

Name Value


PSVersion 5.1.14409.1012
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14409.1012
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Version of the DSC module that was used ('dev' if using current dev branch)

dev

@stale
Copy link

stale bot commented Dec 5, 2018

This issue has been automatically marked as stale because it has not had activity from the community in the last 30 days. It will be closed if no further activity occurs within 10 days. If the issue is labelled with any of the work labels (e.g bug, enhancement, documentation, or tests) then the issue will not auto-close.

@stale stale bot added the stale The issue or pull request was marked as stale because there hasn't been activity from the community. label Dec 5, 2018
@jdwhited
Copy link
Author

jdwhited commented Dec 5, 2018

Thoughts?

@stale stale bot removed the stale The issue or pull request was marked as stale because there hasn't been activity from the community. label Dec 5, 2018
@stale
Copy link

stale bot commented Jan 5, 2019

This issue has been automatically marked as stale because it has not had activity from the community in the last 30 days. It will be closed if no further activity occurs within 10 days. If the issue is labelled with any of the work labels (e.g bug, enhancement, documentation, or tests) then the issue will not auto-close.

@jdwhited
Copy link
Author

jdwhited commented Jan 7, 2019

I don't think I can label this, correct?

@johlju johlju added enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community. labels Jan 24, 2019
@johlju
Copy link
Member

johlju commented Jan 24, 2019

@jdwhited Sorry for not labeling this before this, I have been busy with the day job. But starting to get some time to focus on issues and reviewing PR's now.

@johlju
Copy link
Member

johlju commented Jan 24, 2019

@jdwhited It would be great to add an example file for this change as well when this issue is resolved.

@SteveL-MSFT SteveL-MSFT added this to Help Wanted in powershell/dscresources May 14, 2019
@SteveL-MSFT SteveL-MSFT removed this from Help Wanted in powershell/dscresources Nov 27, 2019
@johlju johlju changed the title xCluster: Cluster created with path CN= is not idempotent Cluster: Cluster created with path CN= is not idempotent Jun 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community.
Projects
None yet
Development

No branches or pull requests

2 participants