Giter VIP home page Giter VIP logo

mimdsc's Issues

Add DSC resource for MVAttributeType

  • Add the DSC resource to the module
  • Get module and schema to pass validation
  • Add tests
  • Add tests to the automated build
  • Add wiki page
  • Add support to DSC generator

Add DSC resource for MAPartitionData

  • Add the DSC resource to the module
  • Get module and schema to pass validation
  • Add tests
  • Add tests to the automated build
  • Add wiki page
  • Add support to DSC generator

Add DSC resource for RunProfile

  • Add the DSC resource to the module
  • Get module and schema to pass validation
  • Add tests
  • Add tests to the automated build
  • Add wiki page
  • Add support to DSC generator

Add DSC resource for Import Attribute Flow Rules

  • Add the DSC resource to the module
  • Get module and schema to pass validation
  • Add tests
    • Direct IAF
    • Scripted IAF
    • Constant IAF
  • Add wiki page
  • Add IAF rule support to DSC generator
  • Add IAF tests to the automated build

Add DSC resource for MVDeletionRule

  • Add the DSC resource to the module
  • Get module and schema to pass validation
  • Add tests
  • Add tests to the automated build
  • Add wiki page
  • Add support to DSC generator

Add DSC resource for MaData

  • Add the DSC resource to the module
  • Get module and schema to pass validation
  • Add tests
  • Add tests to the automated build
  • Add wiki page
  • Add support to DSC generator

Add DSC resource for MVOptions

  • Add the DSC resource to the module
  • Get module and schema to pass validation
  • Add tests
  • Add tests to the automated build
  • Add wiki page
  • Add support to DSC generator

Add DSC resource for MVObjectType

  • Add the DSC resource to the module
  • Get module and schema to pass validation
  • Add tests
  • Add tests to the automated build
  • Add wiki page
  • Add support to DSC generator

Add DSC resource for Join Rules

  • Add the DSC resource to the module
  • Get module and schema to pass validation
  • Add tests
    • Direct
    • Scripted
  • Add wiki page
  • Add Join Rule support to DSC generator
  • Add Join Rule tests to the automated build

ImportAttributeFlowRule key properties not unique

Using the DSC configuration generator I found that the IAF rules generated were not unique (failed when trying to create the MOF file). The items have unique names (a GUID) but the key properties between two DSC resources are the same.
Probably need to change the IAF DSC resource schema to make items more unique.

It really boils down to an issue with DSC schema, captured nicely in this StackOverflow issue:
DSC Package resource have identical key properties

Here is the guide for authoring DSC resources:
Writing a custom DSC resource

The reason for not just using SrcAttribute as a Key property is that IAF rules will not always have a source attribute; for example:

  • DNPart IAF rules just use the DN so the sync config does not refer to a SrcAttribute
  • Constant IAF rules just use a ConstantValue so the sync config again does not refer to a SrcAttribute

Solution options

  • Introduce a Fake Identifier property as Key - ugly but workable
  • Create DSC resources for each IAF rule sub-type (Direct, Scripted, DN, DNPart, Constant) -
    lots of extra resources and duplicate code
  • Overload SrcAttribute such that IAF rules that do not require it use it instead of 'DNPart' or 'ConstantValue' - breaks the clean link from the DSC resource schema to the sync XML, but results in a nice looking DSC resource without the fake identifier.
    Unfortunately this hack won't work because an array property cannot be a key.

Repro

Configuration TestMimSyncConfig 
{ 
    Import-DscResource -ModuleName MimSyncDsc

    Node (hostname) 
    { 
       ImportAttributeFlowRule af5ca310-1d8c-4669-95c2-1f7d0482cb8f
        {   
            ManagementAgentName    = 'TinyHR'
            MVObjectType           = 'Contact'
            MVAttribute            = 'DisplayName'
            CDObjectType           = 'person'
            Type                   = 'direct-mapping'
            SrcAttribute           = 'LastName'
            Ensure                 = 'Present'
        }
    
        ImportAttributeFlowRule e1261aaa-de1a-4af0-8373-2c6c6fb76713
        {   
            ManagementAgentName    = 'TinyHR'
            MVObjectType           = 'Contact'
            MVAttribute            = 'DisplayName'
            CDObjectType           = 'person'
            Type                   = 'direct-mapping'
            SrcAttribute           = 'FirstName'
            Ensure                 = 'Present'
        }
    }
} 

TestMimSyncConfig -OutputPath "$env:TEMP\TestMimSyncConfig"
Start-DscConfiguration       -Path "$env:TEMP\TestMimSyncConfig" -Force -Wait -Verbose 

Error

Test-ConflictingResources : A conflict was detected between resources '[ImportAttributeFlowRule]af5ca310-1d8c-4669-95c2-1f7d0482cb8f (::7::8::ImportAttributeFlowRule)' and '[ImportAttributeFlowRule]e1261aaa-de1a-4af0-8373-2c6c6fb76713 
(::18::9::ImportAttributeFlowRule)' in node 'cmartbook'. Resources have identical key properties but there are differences in the following non-key properties: 'SrcAttribute'. Values 'LastName' don't match values 'FirstName'. Please update these 
property values so that they are identical in both cases.
At line:289 char:9
+         Test-ConflictingResources $keywordName $canonicalizedValue $k ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Write-Error], InvalidOperationException
    + FullyQualifiedErrorId : ConflictingDuplicateResource,Test-ConflictingResources
Compilation errors occurred while processing configuration 'TestMimSyncConfig'. Please review the errors reported in error stream and modify your configuration code appropriately.
At C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\PSDesiredStateConfiguration.psm1:3917 char:5
+     throw $ErrorRecord
+     ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (TestMimSyncConfig:String) [], InvalidOperationException
    + FullyQualifiedErrorId : FailToProcessConfiguration

Add DSC resource for ProjectionRule

  • Add the DSC resource to the module
  • Get module and schema to pass validation
  • Add tests
  • Add tests to the automated build
  • Add wiki page
  • Add support to DSC generator

Using the LCM During Build for Testing

Tests for the MIMSyncDsc module take two approaches:

  • Unit Test: Import the specific resource module (.psm1) file directly and call:
    • Get-TargetResource
    • Test-TargetResource
    • Set-TargerResource
  • Integration Test: Create a DSC configuration with a single item
    • Execute the DSC configuration (basic validation to get it into memory)
    • Generate the MOF file
    • Start the Local Configuration Manager to run the config
    • Validate the LCM status

The unit test approach works nicely for debugging and testing because it does not require the LCM.
Initial attempts at accessing the LCM during AzureDevOps Pipeline builds ran into permission errors. If this can be figured out then wider tests can be executed for builds.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.