microsoft / Requirements

PowerShell framework for declaratively defining and idempotently imposing system configurations
MIT License
159 stars 26 forks source link

Namespace issue in New-RequirementGroup #61

Closed jazz127 closed 4 years ago

jazz127 commented 4 years ago

I downloaded and have been trying out the module from the gallery version 2.3.4.

Whilst it's very likely that I'm doing something wrong, when I take the sample namespace code from the readme, the output on my systems shows :: instead of the actual namespace from the requriementgroup.

I found that i had to update line 162 of interface.ps1 to use $name instead ($r.Namespace = $Name, $r.Namespace -join $NamespaceDelimiter) because some for some reason the alias doesn't work on my system.

Sorry if this isn't logged in the exactly correct method (it's my first day)

chriskuech commented 4 years ago

Can you give me the exact snippet that fails? I'm unable to reproduce the issue so far.

jazz127 commented 4 years ago

Hi,

Here's an example that I made and it's associated output. It also occurs on the sample code from the "Managing large configurations with Namespaces" section using exact copy and paste.

New-RequirementGroup -Name "Parentgroup" {
    New-RequirementGroup -Name "childgroup" {
        New-Requirement -Namespace "requirement1" -Describe "This a requirement" -Test {Test-Path C:\requirementtest} -Set {MKDIR C:\requirementtest}
    }
}
Namespace : ::requirement1
Describe  : This a requirement
Test      : Test-Path C:\requirementtest
Set       : MKDIR C:\requirementtest
DependsOn : {}

` I've tried this on a couple of machines and get the same issue until I edit the source code of the module as above.

` PS C:\Windows\system32> $PSVersionTable

Name Value


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

chriskuech commented 4 years ago

I think this was a weird scoping issue that broke one of my tests. I just fixed and added your test case.