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

Added Get-DscSplattedResource #4

Closed
wants to merge 2 commits into from
Closed

Conversation

VertigoRay
Copy link

@VertigoRay VertigoRay commented Apr 13, 2018

Two main changes:

  • Moved Tests folder to root
  • Added Get-DscSplattedResource

A couple of Pester Tests are added and passing:
image

Moved Tests folder to root

Added Get-DscSplattedResource

  • This is not the same version of the function in Datum, but a lot of the code will feel familiar. This version of Get-DscSplattedResource:

    • Allows the use of $using variables.
    • Preps the properties with the Resource so that the originally called scope, doesn't need to know the parameters that were used:
    $res = Get-DscSplattedResource @splat
    $res.Invoke()
    • Not knowing the parameters that were used is useful when you have function calls that slap together a hashtable for splatting into Get-DscSplattedResource:
    $res = Get-ResourceForMe
    $res.Invoke()

- Per the [Creating a High Quality DSC Resource Module](https://github.com/PowerShell/DscResources/blob/master/HighQualityModuleGuidelines.md) guidelines.
- Also, this keeps the Tests from being installed via PSGallery.
- This is not the same version of the function in Datum, but a lot of the code will feel familiar. This version of `Get-DscSplattedResource`:
  - Allows the use of `$using` variables.
  - Preps the properties with the Resource so that the originally called scope, doesn't need to know the parameters that were used:

  ```powershell
  $res = Get-DscSplattedResource @Splat
  $res.Invoke()
  ```

  - Not knowing the parameters that were used is useful when you have functions calls the build code that call `Get-DscSplattedResource`:

  ```powershell
  $res = Get-ResourceForMe
  $res.Invoke()
  ```

This can be seen in action here:
https://github.com/UNT-CAS/OneDriveDsc/blob/18955a7854e5dcfb0abacc0344d07cbcfea525aa/OneDrive/OneDrive.schema.psm1#L371-L378
@VertigoRay
Copy link
Author

If this gets merged, I'll close out my issue in OneDriveDsc.

@gaelcolas
Copy link
Owner

Thanks very much for this!
Quick review (on my phone) looks really good, nothing I could see blocking a merge.
I want to test first though (in my existing projects), and will be traveling quite a bit for the next 2 weeks.
Hopefully I'll get it merged soon, but don't be alarmed if you don't hear back before early may.

@raandree
Copy link
Collaborator

Closed this as there was no follow-up since years.

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