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

xCluster*: Added support for distinguished cluster name #258

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

IlleNilsson
Copy link

@IlleNilsson IlleNilsson commented Apr 18, 2021

Pull Request (PR) description

Adds support for distinguished cluster name so one can place the cluster node in specific OU

This Pull Request (PR) fixes the following issues

Issue #256

Task list

  • Added an entry to the change log under the Unreleased section of the
    file CHANGELOG.md. Entry should say what was changed and how that
    affects users (if applicable), and reference the issue being resolved
    (if applicable).
  • Resource documentation added/updated in README.md.
  • Resource parameter descriptions added/updated in README.md, schema.mof
    and comment-based help.
  • Comment-based help added/updated.
  • Localization strings added/updated in all localization files as appropriate.
  • Examples appropriately added/updated.
  • Unit tests added/updated. See DSC Community Testing Guidelines.
  • Integration tests added/updated (where possible). See DSC Community Testing Guidelines.
  • New/changed code adheres to DSC Community Style Guidelines.

This change is Reviewable

@codecov
Copy link

codecov bot commented Apr 18, 2021

Codecov Report

Merging #258 (bd656ae) into main (faa9aa3) will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@         Coverage Diff         @@
##           main   #258   +/-   ##
===================================
  Coverage   100%   100%           
===================================
  Files         8      9    +1     
  Lines       611    630   +19     
===================================
+ Hits        611    630   +19     
Impacted Files Coverage Δ
source/DSCResources/DSC_Cluster/DSC_Cluster.psm1 100% <100%> (ø)
...usterPreferredOwner/DSC_ClusterPreferredOwner.psm1 100% <100%> (ø)
...urces/DSC_ClusterProperty/DSC_ClusterProperty.psm1 100% <100%> (ø)
...sources/DSC_WaitForCluster/DSC_WaitForCluster.psm1 100% <100%> (ø)
...erClusterDsc.Common/FailoverClusterDsc.Common.psm1 100% <100%> (ø)

@johlju johlju added the needs review The pull request needs a code review. label Apr 19, 2021
@johlju johlju self-requested a review April 19, 2021 18:20
@johlju
Copy link
Member

johlju commented Apr 22, 2021

I need to have time to look into this change. I will try to get to it as soon as possible, but having a lot on my plate at the moment.

@johlju
Copy link
Member

johlju commented Apr 22, 2021

If you can add unit tests to the changes in the PR so they changes is being tested. That would help as I need that to merge the code.

@dennisl68-castra
Copy link

@IlleNilsson Could you please have a look at the failed Unit tests?
They don't seem very hard to fix...

@IlleNilsson
Copy link
Author

IlleNilsson commented Sep 23, 2021 via email

@dennisl68-castra
Copy link

@IlleNilsson Perhaps you could review the failed Unit Tests in this Pull Request (look at the Details of each failed stage of Review requested) and remedy the failures of your request and then push your code again for a new review?

@IlleNilsson
Copy link
Author

IlleNilsson commented Sep 23, 2021 via email

@dennisl68-castra
Copy link

dennisl68-castra commented Sep 23, 2021

@johlju The build isn't available anymore so I can't review the failed tests...
I'll try to find some of the issues by hand and then pushing the changes to trigger new builds and tests...

@dennisl68-castra
Copy link

If you can add unit tests to the changes in the PR so they changes is being tested. That would help as I need that to merge the code.

Ok, so what's missing now is additional unit tests for the added functionality?
I think I can have a resource available for that in a couple of weeks on our side (I don't know how to write proper Unit tests myself yet)...

@dennisl68-castra
Copy link

As we will drop the use of xCluster, I will not pursue this Pull Request.

@johlju johlju force-pushed the main branch 2 times, most recently from 9fc6c16 to eac0ffd Compare June 19, 2022 14:58
@johlju johlju self-requested a review June 19, 2022 16:19
Copy link
Member

@johlju johlju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added a unit test for this change that can be extended, see other comment.

Reviewed 1 of 12 files at r1, 10 of 14 files at r3, all commit messages.
Reviewable status: 11 of 15 files reviewed, 3 unresolved discussions (waiting on @IlleNilsson and @johlju)

a discussion (no related file):
This code do have two disadvantage

  • it is possible to create two clusters with the same name in the same configuration, e.g. by passing 'CLUSTER' and 'CN=CLUSTER'
  • it is possible to manually move the cluster to another location at it will not be moved back to the desired location since the location (DN) is not enforced with this change.

The first one we might have to live with, but can we resolve the second, and if so, is this the correct resource to enforce location?


a discussion (no related file):
Since we do not have integration tests, has anyone run the changed resources so it do work?



source/Modules/FailoverClusterDsc.Common/FailoverClusterDsc.Common.psm1 line 14 at r3 (raw file):

        Distinguished Name to be converted to a Simple Name
#>
function Convert-DistinguishedNameToSimpleName

Suggest changing the function to this. But on top of that this function must also handle any special characters that are all allowed in a distinguished name and make tests that validates those, see more information: https://ldap.com/ldap-dns-and-rdns/

It should probably also fail if a DN was passed but did not start with CN=.

Suggestion:

function Convert-DistinguishedNameToSimpleName
{
    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'returnValue')]
    [CmdletBinding()]
    [OutputType([System.String])]
    param
    (
        [Parameter(Mandatory = $true)]
        [System.String]
        $DistinguishedName
    )

    $returnValue = $DistinguishedName

    if ($DistinguishedName -match '^([c|C][n|N])=(.*?(?=,))')
    {
        $returnValue = $matches[2]
    }

    return $returnValue
}

Copy link
Member

@johlju johlju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 11 of 15 files reviewed, 3 unresolved discussions (waiting on @IlleNilsson and @johlju)

a discussion (no related file):

Previously, johlju (Johan Ljunggren) wrote…

This code do have two disadvantage

  • it is possible to create two clusters with the same name in the same configuration, e.g. by passing 'CLUSTER' and 'CN=CLUSTER'
  • it is possible to manually move the cluster to another location at it will not be moved back to the desired location since the location (DN) is not enforced with this change.

The first one we might have to live with, but can we resolve the second, and if so, is this the correct resource to enforce location?

What if we have DN in a separate property called OrganizationUnitDistinguishedName that holds the path to the OU? Then we resolve first item above, by combining the property Name and OrganizationUnitDistinguishedName we get the full DN, and then we correctly can only have one instance of one cluster name.
We will also be able to enforce the location if the property OrganizationUnitDistinguishedName is passes. If not passed then location is not enforced.


@johlju johlju self-requested a review June 19, 2022 16:26
@johlju johlju added waiting for code fix A review left open comments, and the pull request is waiting for changes to be pushed by the author. and removed needs review The pull request needs a code review. labels Jun 19, 2022
@johlju
Copy link
Member

johlju commented Jun 19, 2022

This PR is ready for someone to continue running with it. Let me know when it needs another review. 🙂

@stale
Copy link

stale bot commented Jul 10, 2022

Labeling this pull request (PR) as abandoned since it has gone 14 days or more since the last update. An abandoned PR can be continued by another contributor. The abandoned label will be removed if work on this PR is taken up again.

@stale stale bot added the abandoned The pull request has been abandoned. label Jul 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
abandoned The pull request has been abandoned. waiting for code fix A review left open comments, and the pull request is waiting for changes to be pushed by the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants