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

Add Windows Package Cab #251

Merged
merged 1 commit into from
Oct 8, 2016

Conversation

kwirkykat
Copy link
Contributor

@kwirkykat kwirkykat commented Oct 7, 2016

This is part of #160.
This is a new resource that was recently provided in-box specifically for Nano Server (though it also works on full Windows Server) in order to install downloaded packages from Windows cabinet (.cab) files.

The in-box WindowsPackageCab resource has been translated to a mof-based resource (from a class-based resource) so that it works here with WMF 4.
This resource now has 100% unit test coverage.

I have run the integration tests manually on both full Windows Server and Windows Nano Server, and all tests are passing.
Unfortunately, I cannot include the cab file I used for integration testing on GitHub, so the two integration tests that require an actual cab file will be skipped on AppVeyor for now.
If you would like to run the integration tests yourself, you will need to provide your own cab file in the BeforeAll block of the WindowsPackageCab integration tests. Also, if you do run the full integration tests, make sure they are running on a disposable VM instead of on your development machine.

We are working on locating a suitable cab file for automated testing.

@mbreakey3 Please review


This change is Reviewable

@kwirkykat kwirkykat added the needs review The pull request needs a code review. label Oct 7, 2016
@kwirkykat kwirkykat force-pushed the AddWindowsPackageCab branch 4 times, most recently from 1fabf9f to 22dc1f8 Compare October 7, 2016 18:13
@mbreakey3
Copy link
Contributor

Reviewed 1 of 9 files at r1.
Review status: 1 of 9 files reviewed at latest revision, 1 unresolved discussion.


README.md, line 38 at r1 (raw file):

* **xWindowsOptionalFeature** provides a mechanism to enable or disable optional features on a target node.
* **xWindowsOptionalFeatureSet** allows installation and uninstallation of a group of optional Windows features.
* **xWindowsPackageCab** provides a mechanism to to install or uninstall a package from a windows cabinet (cab) file on a target node.

Extra 'to'


Comments from Reviewable

@mbreakey3
Copy link
Contributor

Reviewed 8 of 9 files at r1.
Review status: all files reviewed at latest revision, 9 unresolved discussions.


DSCResources/MSFT_xWindowsPackageCab/MSFT_xWindowsPackageCab.psm1, line 15 at r1 (raw file):

    .PARAMETER Ensure
        Not used in Get-TargetResource.
        Provided here only because PSScriptAnalyzer complains otherwise.

'Provide here to follow DSC design policy of requiring Get/Set/Test to have the same Mandatory Parameters'


Examples/Sample_xWindowsPackageCab.ps1, line 3 at r1 (raw file):

<#
    .SYNOPSIS
        Install a package from cab file with the specified name from the specified source path and outputs a log to the specified log path.

'from the cab file' also, maybe split this up into 2 lines


Tests/Integration/MSFT_xWindowsPackageCab.Integration.Tests.ps1, line 1 at r1 (raw file):

Import-Module -Name "$PSScriptRoot\..\CommonTestHelper.psm1"

Use Join/Split :p


Tests/Integration/MSFT_xWindowsPackageCab.Integration.Tests.ps1, line 28 at r1 (raw file):

                {
                    $script:packageOriginallyInstalled = $true

extra newline here needs to be deleted


Tests/Unit/MSFT_xWindowsPackageCab.Tests.ps1, line 1 at r1 (raw file):

Import-Module -Name "$PSScriptRoot\..\CommonTestHelper.psm1"

Join/Split


Tests/Unit/MSFT_xWindowsPackageCab.Tests.ps1, line 30 at r1 (raw file):

                }

                It 'Should return Ensure as Absent when package is absent' {

'...when package is not installed'


Tests/Unit/MSFT_xWindowsPackageCab.Tests.ps1, line 37 at r1 (raw file):

                }

                It 'Should return Ensure as Absent when package is present but not installed' {

this says 'when package is present but not installed' but the Mock is returning 'NotPresent' is this the correct description?


Tests/Unit/MSFT_xWindowsPackageCab.Tests.ps1, line 76 at r1 (raw file):

                It 'Should throw when SourcePath is invalid' {
                    $invalidSourcePath = (Join-Path -Path $TestDrive -ChildPath 'DoesNotExist')
                    { Set-TargetResource -Name 'Name' -SourcePath $invalidSourcePath -Ensure 'Absent' } | Should Throw ($script:localizedData.SourcePathDoesNotExist -f $invalidSourcePath)

split up this line


Comments from Reviewable

@kwirkykat kwirkykat force-pushed the AddWindowsPackageCab branch from 22dc1f8 to 4f1faae Compare October 8, 2016 01:03
@mbreakey3
Copy link
Contributor

Review status: 4 of 9 files reviewed at latest revision, 9 unresolved discussions.


README.md, line 38 at r1 (raw file):

Previously, mbreakey3 (Mariah) wrote…

Extra 'to'

OK

DSCResources/MSFT_xWindowsPackageCab/MSFT_xWindowsPackageCab.psm1, line 15 at r1 (raw file):

Previously, mbreakey3 (Mariah) wrote…

'Provide here to follow DSC design policy of requiring Get/Set/Test to have the same Mandatory Parameters'

OK

Examples/Sample_xWindowsPackageCab.ps1, line 3 at r1 (raw file):

Previously, mbreakey3 (Mariah) wrote…

'from the cab file' also, maybe split this up into 2 lines

OK

Tests/Integration/MSFT_xWindowsPackageCab.Integration.Tests.ps1, line 1 at r1 (raw file):

Previously, mbreakey3 (Mariah) wrote…

Use Join/Split :p

OK

Tests/Integration/MSFT_xWindowsPackageCab.Integration.Tests.ps1, line 28 at r1 (raw file):

Previously, mbreakey3 (Mariah) wrote…

extra newline here needs to be deleted

OK

Tests/Unit/MSFT_xWindowsPackageCab.Tests.ps1, line 1 at r1 (raw file):

Previously, mbreakey3 (Mariah) wrote…

Join/Split

OK

Tests/Unit/MSFT_xWindowsPackageCab.Tests.ps1, line 30 at r1 (raw file):

Previously, mbreakey3 (Mariah) wrote…

'...when package is not installed'

OK

Tests/Unit/MSFT_xWindowsPackageCab.Tests.ps1, line 37 at r1 (raw file):

Previously, mbreakey3 (Mariah) wrote…

this says 'when package is present but not installed' but the Mock is returning 'NotPresent' is this the correct description?

OK

Tests/Unit/MSFT_xWindowsPackageCab.Tests.ps1, line 76 at r1 (raw file):

Previously, mbreakey3 (Mariah) wrote…

split up this line

OK

Comments from Reviewable

@mbreakey3
Copy link
Contributor

:lgtm:


Reviewed 5 of 5 files at r2.
Review status: all files reviewed at latest revision, 9 unresolved discussions.


Comments from Reviewable

@kwirkykat kwirkykat merged commit 10d6464 into dsccommunity:dev Oct 8, 2016
@kwirkykat kwirkykat removed the needs review The pull request needs a code review. label Oct 8, 2016
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