dsccommunity / FailoverClusterDsc

This module contains DSC resources for deployment and configuration of Windows Server Failover Cluster.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MSFT_xCluster - Common helper module not importing properly

wsmelton opened this issue · comments

Changes in folder layout and import process for the helper module no longer works. Testing a configuration that is using xCluster resource ends with this failure:

writeErrorStream      : True
PSMessageDetails      :
OriginInfo            : localhost
Exception             : Microsoft.Management.Infrastructure.CimException: Importing module MSFT_xCluster failed with
                        error - The term 'Get-LocalizedData' is not recognized as the name of a cmdlet, function,
                        script file, or operable program. Check the spelling of the name, or if a path was included,
                        verify that the path is correct and try again.
                           at Microsoft.Management.Infrastructure.Internal.Operations.CimAsyncObserverProxyBase`1.Proce
                        ssNativeCallback(OperationCallbackProcessingContext callbackProcessingContext, T currentItem,
                        Boolean moreResults, MiResult operationResult, String errorMessage, InstanceHandle
                        errorDetailsHandle)
TargetObject          : root/Microsoft/Windows/DesiredStateConfiguration:MSFT_DSCLocalConfigurationManager
CategoryInfo          : InvalidOperation: (root/Microsoft/...gurationManager:String) [], CimException
FullyQualifiedErrorId : ImportModuleFailed
ErrorDetails          :
InvocationInfo        :
ScriptStackTrace      :
PipelineIterationInfo : {}

Seems to be tied down to the import of the CommonResourceHelper is not happening properly. This is on version 1.14.0 of the xFailoverCluster module.

Manifest file needs to be updated to include the root module and export of functions so PS properly imports the psm1 file. Local testing and the contents of the CommonResourceHelper.psd1 allows everything to work again:

@{
    # Version number of this module.
    ModuleVersion = '1.0'
    # ID used to uniquely identify this module
    GUID = 'b8e5084a-07a8-4135-8a26-00614e56ba71'

    RootModule = 'CommonResourceHelper.psm1'

    # Author of this module
    Author = 'DSC Community'

    # Company or vendor of this module
    CompanyName = 'DSC Community'

    # Copyright statement for this module
    Copyright = 'Copyright the DSC Community contributors. All rights reserved.'

    # Description of the functionality provided by this module
    Description = 'Functions used by the DSC resources in SqlServerDsc.'

    # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
    FunctionsToExport = @('New-InvalidArgumentException',
    'New-InvalidOperationException',
    'New-ObjectNotFoundException',
    'New-InvalidResultException',
    'Get-LocalizedData')

    # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
    CmdletsToExport = @()

    # Variables to export from this module
    VariablesToExport = @()

    # Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
    AliasesToExport = @()

    # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
    PrivateData = @{
        PSData = @{
        } # End of PSData hashtable
     } # End of PrivateData hashtable
}

Additional item, the MSFT_xCluster.psm1 file will need to directly import the psd1 file:

Import-Module -Name "$script:resourceHelperModulePath\CommonResourceHelper.psd1" -Verbose

Just using the folder path does not work.