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

Seems to be a problem "Splatting" to xWebSite #113

Open
Br4v3St4rr opened this issue Sep 28, 2021 · 5 comments
Open

Seems to be a problem "Splatting" to xWebSite #113

Br4v3St4rr opened this issue Sep 28, 2021 · 5 comments

Comments

@Br4v3St4rr
Copy link
Contributor

Hi,

There seems to be a problem when running

(Get-DscSplattedResource -ResourceName xWebSite -ExecutionName $executionName -Properties $item -NoInvoke).Invoke($item)

When you have nested AuthenticationInfo or BindingInfo Present.

@stehlih
Copy link
Contributor

stehlih commented Sep 28, 2021

Please add an YAML configuration file to reproduce the error.
The nested AuthenticationInfo or BindingInfo properties are currently not part of the CommonTasks Unit Tests.

@gaelcolas
Copy link
Member

It's true that the Get-DscSplattedResource does not work with nested type out of the box though.

@Br4v3St4rr
Copy link
Contributor Author

If you see the following:

WebSites:
  Items:
    # Remove Default WebSite
    - Name: Default Web Site
      Ensure: Absent
    # Create New WebSite
    - Name: Site Number 1
      ApplicationPool: site1
      Ensure: Present
      PhysicalPath: F:\AFolder\Site1
      PreloadEnabled: true
      AuthenticationInfo:
        Anonymous: True
        Basic: False
        Digest: False
        Windows: False
      BindingInfo:
        - Protocol: http
          Port: 80
          HostName: site1.contoso.com
        - Protocol: https
          Port: 443
          HostName: site1.contos.com
          CertificateThumbprint: 400985E6876BF8D205F383C1B0815FA3F33AD244
          CertificateStoreName: WebHosting

AuthenticationInfo and BindingInfo wont work. I have managed to frig my way around AuthenticationInfo with the DSC Resource Schema. However getting the Bindings to work dynamically has not been so successful. I have managed to frig it to meet my current needs though.

@gaelcolas is there a way to modify Get-DscSplattedResource to work with nested type? It seems to be somewhat difficult?

@gaelcolas
Copy link
Member

There is a way, I had a prototype a couple of years ago but might have been at a customer.
Basically, we need Get-DscSplattedResource to be a bit more clever and find more details about the DSC Resources its implementing, and when it sees a subtype (i.e. not a common type), it should "build it" (i.e. build a cimInstance of it instead of just passing an hashtable).
Not technically difficult, but not trivial either and need to make sure we're not slowing down the compilation time too much, nor hindering the autoloading of module/resources (but I think that's taken care of in the rootConfig.ps1 so that should be ok).
Just thinking out loud here.

@raandree
Copy link
Contributor

@gaelcolas, how big is the chance that you find that prototype?

BTW, the error message we get here is:

Write-NodeMOFFile : Invalid MOF definition for node 'localhost_WebSites': Exception calling "ValidateInstanceText" with "1" argument(s): "Convert property 'AuthenticationInfo' value from type 'STRING' to type 'INSTANCE' failed

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

4 participants