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

Update NanoComputeExample.ps1 #259

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open

Update NanoComputeExample.ps1 #259

wants to merge 1 commit into from

Conversation

Panzerbjrn
Copy link
Contributor

When running this configuration, this error occurs:
At line:27 char:17

  •             PrefixLength   = $node.PrefixLength;
    
  •             ~~~~~~~~~~~~
    

The member 'PrefixLength' is not valid. Valid members are
'AddressFamily', 'DependsOn', 'InterfaceAlias', 'IPAddress', 'PsDscRunAsCredential'.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : InvalidInstanceProperty

#'ing out line 27 enables it to run without error.

When running this configuration, this error occurs:
At line:27 char:17
+                 PrefixLength   = $node.PrefixLength;
+                 ~~~~~~~~~~~~
The member 'PrefixLength' is not valid. Valid members are
'AddressFamily', 'DependsOn', 'InterfaceAlias', 'IPAddress', 'PsDscRunAsCredential'.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : InvalidInstanceProperty

#'ing out line 27 enables it to run without error.
@ChrisLGardner
Copy link

ChrisLGardner commented Oct 19, 2017

Which version of xNetworking are you using? PrefixLength was around in 3.x and 4.x, 5.x added new functionality to specify the IP as CIDR notation and allow setting multiple at a time, as part of this it removed the PrefixLength property.

Maybe we need to specify the version of the module to be used in this example?

Same applies to #260 and #261

@iainbrighton
Copy link
Contributor

Hi @Panzerbjrn - this sounds like you don't have the correct version of the xNetworking DSC resource installed on the machine that you're trying to compile the configuration on.

There was a breaking change to the schema in the xNetworking 3.0.0.0 release. The SubnetMask property was replaced by the PrefixLength parameter. Therefore, it sounds like you have a version older than v3.0.0.0. Can you confirm what version of xNetworking you have installed?

[1] C:\..\Dropbox\PowerShell> Get-DscResource -Name xIPAddress -Module xNetworking

ImplementedAs   Name                      ModuleName                     Version    Properties
-------------   ----                      ----------                     -------    ----------
PowerShell      xIPAddress                xNetworking                    3.2.0.0    {InterfaceAlias, IPAddress, Addr...

[2] C:\..\Dropbox\PowerShell> Get-DscResource -Name xIPAddress -Module xNetworking -Syntax
xIPAddress [String] #ResourceName
{
    InterfaceAlias = [string]
    IPAddress = [string]
    [AddressFamily = [string]{ IPv4 | IPv6 }]
    [DependsOn = [string[]]]
    [PrefixLength = [UInt32]]
    [PsDscRunAsCredential = [PSCredential]]
}

[3] C:\..\Dropbox\PowerShell>

You will need to have v3.2.0.0 installed on your host that you're generating the .mof files on - as this is what is defined in the example .psd1 configuration data file. If you want to use an alternate version you'll need to update the .psd1 file accordingly and make sure you have that installed on the host!

@iainbrighton
Copy link
Contributor

@Panzerbjrn or as @ChrisLGardner points out - you might have a v5.x release installed where it was changed again. And this is the reason why the module versions are specified in the .psd1 file 😠!

If we want to update the examples to use v5.x of the xNetworking module you will need to make a change to the .psd1 file as well in this PR. Does this make sense?

@Panzerbjrn
Copy link
Contributor Author

Correct, I have version 5.2.0.0.
If an older version of a module is required, that should really be documented in the file that is using that module.

@iainbrighton
Copy link
Contributor

@Panzerbjrn What you're seeing here is a typical DSC issue and doesn't really have anything to do with Lability. When the example was written, v3.2.0.0 of the xNetworking module would have been the latest. Unfortunately, the schema has changed again from the v5.x release.

To update the example to use v5.2.0.0 of the xNetworking module - you will also need to update the node IPAddress and DSC resource RequiredVersion sections in the accompanying NanoComputeExample.psd1 configuration data file. The same goes for #260 and #261 as well.

@ChrisLGardner
Copy link

I'll take the blame for the schema changing in 5.x of xIPAddress. It previously didn't handle setting multiple IP addresses for a single interface and now it does but we had to merge the prefix length into the IPAddress property to support different prefixes for different addresses.

@iainbrighton
Copy link
Contributor

@Panzerbjrn Does this request make sense and are you OK updating the 3 PRs?

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

Successfully merging this pull request may close these issues.

3 participants