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

nContainer module should not require Containers #4

Open
KarolKaczmarek opened this issue Nov 5, 2015 · 0 comments
Open

nContainer module should not require Containers #4

KarolKaczmarek opened this issue Nov 5, 2015 · 0 comments

Comments

@KarolKaczmarek
Copy link

nContainer.psd1 contains

# Modules that must be imported into the global environment prior to importing this module
RequiredModules = @('Containers')

Containers should not be required since the machine may not have this feature enabled. In that case, even if we try to apply configuration which installs this feature:

configuration ContainerSetup
{
    [CmdletBinding()]
    param(
        [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)]
        [string] 
        $ContainerName
    )

    Import-DscResource -ModuleName PSDesiredStateConfiguration -Name WindowsFeature
    Import-DscResource -ModuleName nContainer

    WindowsFeature ContainersFeature
    {
        Name =   'Containers'
        Ensure = 'Present'
    }

    nContainer Container
    {
        Name      = $ContainerName
        ImageName = 'WindowsServerCore'
        Ensure    = 'Present'
        State     = 'Off'
        VirtualSwitchName = 'Virtual Switch'
    }
} 

PowerShell will try to load Containers module during parsing the configuration which results in a failure:

PS C:\Packages\Plugins\Microsoft.Powershell.DSC\2.8.0.0\DSCWork\CreateContainer.ps1.0> Start-DscConfiguration -path .\Co
ntainerSetup\ -Wait -force
Importing module nContainer failed with error - The required module 'Containers' is not loaded. Load the module or
remove the module from 'RequiredModules' in the file 'C:\Program
Files\WindowsPowerShell\Modules\nContainer\nContainer.psd1'.
    + CategoryInfo          : InvalidOperation: (root/Microsoft/...gurationManager:String) [], CimException
    + FullyQualifiedErrorId : ImportModuleFailed
    + PSComputerName        : localhost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant