From 13570dbe71d6502fc5b0ce2c5ea6917374384028 Mon Sep 17 00:00:00 2001 From: gaelcolas Date: Thu, 28 Feb 2019 09:43:31 +0800 Subject: [PATCH 1/7] fixing a few issues as per PowerShell/DscResources#346 Namely: 2, 5 + an untriggered in Markdown (duplicate title) --- DSCResource.Tests | 2 +- ReadMe.md | 9 ++++----- .../MSFT_UpdateServicesApprovalRule.tests.ps1 | 0 .../{.Unit => Unit}/MSFT_UpdateServicesCleanup.tests.ps1 | 0 .../{.Unit => Unit}/MSFT_UpdateServicesServer.tests.ps1 | 0 5 files changed, 5 insertions(+), 6 deletions(-) rename Tests/{.Unit => Unit}/MSFT_UpdateServicesApprovalRule.tests.ps1 (100%) rename Tests/{.Unit => Unit}/MSFT_UpdateServicesCleanup.tests.ps1 (100%) rename Tests/{.Unit => Unit}/MSFT_UpdateServicesServer.tests.ps1 (100%) diff --git a/DSCResource.Tests b/DSCResource.Tests index e7b3589..6a09368 160000 --- a/DSCResource.Tests +++ b/DSCResource.Tests @@ -1 +1 @@ -Subproject commit e7b3589bfba4c80e131ea6baf4f9f712336b6390 +Subproject commit 6a09368d57912fd7cb3f15c6383d03f03a825ae2 diff --git a/ReadMe.md b/ReadMe.md index f1c8c19..f00e6f0 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -80,14 +80,14 @@ To install from the PowerShell gallery using PowerShellGet (in PowerShell 5.0) run the following command: ```powershell -Find-Module -Name SqlServerDsc | Install-Module +Find-Module -Name UpdateServicesDsc | Install-Module ``` To confirm installation, run the below command and ensure you see the SQL Server DSC resources available: ```powershell -Get-DscResource -Module SqlServerDsc +Get-DscResource -Module UpdateServicesDsc ``` ## Requirements @@ -188,11 +188,10 @@ Windows Server 2008 R2 SP1, Windows Server 2012 and Windows Server 2012 R2. * Managing xWSUS rules for content cleanup and compression. * Managing xWSUS service configuration -## Contributing +## Contributing Guidelines Please check out common DSC Resources [contributing guidelines](https://github.com/PowerShell/DscResource.Kit/blob/master/CONTRIBUTING.md). -Thank you -[SqlServerDsc](https://github.com/PowerShell/SqlServerDsc/blob/dev/README.md) +Thank you [SqlServerDsc](https://github.com/PowerShell/SqlServerDsc/blob/dev/README.md) maintainers for your awesome work on style and structure for DSC README files, which is copied here. diff --git a/Tests/.Unit/MSFT_UpdateServicesApprovalRule.tests.ps1 b/Tests/Unit/MSFT_UpdateServicesApprovalRule.tests.ps1 similarity index 100% rename from Tests/.Unit/MSFT_UpdateServicesApprovalRule.tests.ps1 rename to Tests/Unit/MSFT_UpdateServicesApprovalRule.tests.ps1 diff --git a/Tests/.Unit/MSFT_UpdateServicesCleanup.tests.ps1 b/Tests/Unit/MSFT_UpdateServicesCleanup.tests.ps1 similarity index 100% rename from Tests/.Unit/MSFT_UpdateServicesCleanup.tests.ps1 rename to Tests/Unit/MSFT_UpdateServicesCleanup.tests.ps1 diff --git a/Tests/.Unit/MSFT_UpdateServicesServer.tests.ps1 b/Tests/Unit/MSFT_UpdateServicesServer.tests.ps1 similarity index 100% rename from Tests/.Unit/MSFT_UpdateServicesServer.tests.ps1 rename to Tests/Unit/MSFT_UpdateServicesServer.tests.ps1 From 9753ae674f45b88358c051c7225b91445b96838e Mon Sep 17 00:00:00 2001 From: gaelcolas Date: Thu, 28 Feb 2019 13:26:37 +0800 Subject: [PATCH 2/7] fixing PSSA $null wrong side operator --- .../MSFT_UpdateServicesServer.psm1 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/DSCResources/MSFT_UpdateServicesServer/MSFT_UpdateServicesServer.psm1 b/DSCResources/MSFT_UpdateServicesServer/MSFT_UpdateServicesServer.psm1 index 7a77503..31c75d4 100644 --- a/DSCResources/MSFT_UpdateServicesServer/MSFT_UpdateServicesServer.psm1 +++ b/DSCResources/MSFT_UpdateServicesServer/MSFT_UpdateServicesServer.psm1 @@ -863,23 +863,23 @@ function Test-TargetResource } } else { - if((Compare-Object -ReferenceObject ($Wsus.Languages | Sort-Object -Unique) ` - -DifferenceObject ($Languages | Sort-Object -Unique) -SyncWindow 0) -ne $null) + if($null -ne (Compare-Object -ReferenceObject ($Wsus.Languages | Sort-Object -Unique) ` + -DifferenceObject ($Languages | Sort-Object -Unique) -SyncWindow 0)) { Write-Verbose -Message "Languages test failed" $result = $false } } # Test Products - if((Compare-Object -ReferenceObject ($Wsus.Products | Sort-Object -Unique) ` - -DifferenceObject ($Products | Sort-Object -Unique) -SyncWindow 0) -ne $null) + if($null -ne (Compare-Object -ReferenceObject ($Wsus.Products | Sort-Object -Unique) ` + -DifferenceObject ($Products | Sort-Object -Unique) -SyncWindow 0)) { Write-Verbose -Message "Products test failed" $result = $false } # Test Classifications - if((Compare-Object -ReferenceObject ($Wsus.Classifications | Sort-Object -Unique) ` - -DifferenceObject ($Classifications | Sort-Object -Unique) -SyncWindow 0) -ne $null) + if($null -ne (Compare-Object -ReferenceObject ($Wsus.Classifications | Sort-Object -Unique) ` + -DifferenceObject ($Classifications | Sort-Object -Unique) -SyncWindow 0)) { Write-Verbose -Message "Classifications test failed" $result = $false From 8b3c1636f5647a2b39b48f987efa28ba4a4caf8d Mon Sep 17 00:00:00 2001 From: gaelcolas Date: Thu, 28 Feb 2019 14:42:32 +0800 Subject: [PATCH 3/7] fixing PSSA rules for MSFT_UpdateServicesServer --- .../MSFT_UpdateServicesServer.psm1 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/DSCResources/MSFT_UpdateServicesServer/MSFT_UpdateServicesServer.psm1 b/DSCResources/MSFT_UpdateServicesServer/MSFT_UpdateServicesServer.psm1 index 31c75d4..2362694 100644 --- a/DSCResources/MSFT_UpdateServicesServer/MSFT_UpdateServicesServer.psm1 +++ b/DSCResources/MSFT_UpdateServicesServer/MSFT_UpdateServicesServer.psm1 @@ -128,7 +128,8 @@ function Get-TargetResource Write-Verbose -Message "WSUSServer languages are $Languages" Write-Verbose -Message 'Getting WSUSServer classifications' - if ($Classifications = @($WsusSubscription.GetUpdateClassifications().ID.Guid)) { + if ($Classifications = @($WsusSubscription.GetUpdateClassifications().ID.Guid)) + { if($null -eq (Compare-Object -ReferenceObject ($Classifications | Sort-Object -Unique) -DifferenceObject ` (($WsusServer.GetUpdateClassifications().ID.Guid) | Sort-Object -Unique) -SyncWindow 0)) { @@ -140,7 +141,8 @@ function Get-TargetResource } Write-Verbose -Message "WSUSServer classifications are $Classifications" Write-Verbose -Message 'Getting WSUSServer products' - if ($Products = @($WsusSubscription.GetUpdateCategories().Title)) { + if ($Products = @($WsusSubscription.GetUpdateCategories().Title)) + { if($null -eq (Compare-Object -ReferenceObject ($Products | Sort-Object -Unique) -DifferenceObject ` (($WsusServer.GetUpdateCategories().Title) | Sort-Object -Unique) -SyncWindow 0)) { @@ -322,6 +324,7 @@ function Set-TargetResource [System.Boolean] $Synchronize, + [Parameter()] [ValidateSet("Client", "Server")] [System.String] $ClientTargetingMode @@ -768,6 +771,7 @@ function Test-TargetResource [System.Boolean] $Synchronize, + [Parameter()] [ValidateSet("Client", "Server")] [System.String] $ClientTargetingMode From ec9f70a1e8a47f4bbccf82a5a03b52a2a6e9bc31 Mon Sep 17 00:00:00 2001 From: gaelcolas Date: Thu, 28 Feb 2019 15:26:59 +0800 Subject: [PATCH 4/7] fixed Invoke-Expression PSSA issue --- .../MSFT_UpdateServicesCleanup.psm1 | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/DSCResources/MSFT_UpdateServicesCleanup/MSFT_UpdateServicesCleanup.psm1 b/DSCResources/MSFT_UpdateServicesCleanup/MSFT_UpdateServicesCleanup.psm1 index ac3585e..7d9b7da 100644 --- a/DSCResources/MSFT_UpdateServicesCleanup/MSFT_UpdateServicesCleanup.psm1 +++ b/DSCResources/MSFT_UpdateServicesCleanup/MSFT_UpdateServicesCleanup.psm1 @@ -10,7 +10,7 @@ Import-Module $currentPath\..\..\UpdateServicesHelper.psm1 -Verbose:$false -Erro .SYNOPSIS Returns the current CleanUp Task .PARAMETER Ensure - Determinse if the task should be added or removed + Determines if the task should be added or removed #> function Get-TargetResource { @@ -37,11 +37,11 @@ function Get-TargetResource $Arguments = $Task.Actions.Arguments if($Arguments) { - $Arguments = $Arguments.Split("`"") + $Arguments = $Arguments.Split('"') if($Arguments.Count -ge 1) { $Arguments = $Arguments[1].Split(";") - foreach($Var in @( + $ArgumentNames = @( "DeclineSupersededUpdates", "DeclineExpiredUpdates", "CleanupObsoleteUpdates", @@ -49,10 +49,15 @@ function Get-TargetResource "CleanupObsoleteComputers", "CleanupUnneededContentFiles", "CleanupLocalPublishedContentFiles" - )) - { - Set-Variable -Name $Var -Value (Invoke-Expression((($Arguments ` - | Where-Object -FilterScript {$_ -like "`$$Var = *"}) -split " = ")[1])) + ) + foreach ($Var in $Arguments) { + $regex = [regex]'^\$(?.*)\s=\s\$(?.*)$' + $groups = $regex.Match($Var).Groups + $VarName = $groups['name'].value.Trim() + $VarValueString = $groups['value'].value.Trim() + if($VarName -in $ArgumentNames) { + Set-variable -Name $VarName -Value $ExecutionContext.InvokeCommand.ExpandString($VarValueString) + } } } } @@ -201,7 +206,7 @@ if(`$WsusServer) "@ Write-Verbose "Creating new scheduled task for WSUS cleanup rule" - + $Action = New-ScheduledTaskAction -Execute $Command -Argument $Argument $Trigger = New-ScheduledTaskTrigger -Daily -At $TimeOfDay Register-ScheduledTask -TaskName "WSUS Cleanup" -Action $Action -Trigger $Trigger -RunLevel Highest -User "SYSTEM" @@ -327,7 +332,7 @@ function Test-TargetResource $result = $false } } - + $result } From 6f4523bd8c9547184845eff1ca90d1592c818a28 Mon Sep 17 00:00:00 2001 From: gaelcolas Date: Thu, 28 Feb 2019 15:27:42 +0800 Subject: [PATCH 5/7] Adding missing project files --- .MetaTestOptIn.json | 10 +- .codecov.yml | 24 + .gitattributes | 2 + .github/ISSUE_TEMPLATE/General.md | 7 + .../ISSUE_TEMPLATE/Problem_with_resource.md | 61 ++ .github/ISSUE_TEMPLATE/Resource_proposal.md | 21 + .github/PULL_REQUEST_TEMPLATE.md | 50 + .gitignore | 1 + .vscode/analyzersettings.psd1 | 53 ++ .vscode/settings.json | 14 + CHANGELOG.md | 14 + CODE_OF_CONDUCT.md | 6 + TestsResults.xml | 879 ++++++++++++++++++ UpdateServicesDsc.psd1 | 7 +- 14 files changed, 1143 insertions(+), 6 deletions(-) create mode 100644 .codecov.yml create mode 100644 .gitattributes create mode 100644 .github/ISSUE_TEMPLATE/General.md create mode 100644 .github/ISSUE_TEMPLATE/Problem_with_resource.md create mode 100644 .github/ISSUE_TEMPLATE/Resource_proposal.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .gitignore create mode 100644 .vscode/analyzersettings.psd1 create mode 100644 .vscode/settings.json create mode 100644 CHANGELOG.md create mode 100644 CODE_OF_CONDUCT.md create mode 100644 TestsResults.xml diff --git a/.MetaTestOptIn.json b/.MetaTestOptIn.json index 188b4db..2764258 100644 --- a/.MetaTestOptIn.json +++ b/.MetaTestOptIn.json @@ -1,6 +1,12 @@ [ - "Common Tests - Validate Module Files", "Common Tests - Validate Markdown Files", "Common Tests - Validate Example Files", - "Common Tests - Validate Script Files" + "Common Tests - Validate Module Files", + "Common Tests - Validate Script Files", + "Common Tests - Required Script Analyzer Rules", + "Common Tests - Flagged Script Analyzer Rules", + "Common Tests - New Error-Level Script Analyzer Rules", + "Common Tests - Custom Script Analyzer Rules", + "Common Tests - Relative Path Length", + "Common Tests - Validate Markdown Links" ] diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 0000000..29a05dd --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,24 @@ +codecov: + notify: + require_ci_to_pass: no + +comment: + layout: "reach, diff" + behavior: default + +coverage: + range: 50..80 + round: down + precision: 0 + + status: + project: + default: + # Set the overall project code coverage requirement to 70% + target: 70 + patch: + default: + # Set the pull request requirement to not regress overall coverage by more than 5% + # and let codecov.io set the goal for the code changed in the patch. + target: auto + threshold: 5 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..5613d53 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Needed for publishing of examples, build worker defaults to core.autocrlf=input. +* text eol=crlf diff --git a/.github/ISSUE_TEMPLATE/General.md b/.github/ISSUE_TEMPLATE/General.md new file mode 100644 index 0000000..fbcdf24 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/General.md @@ -0,0 +1,7 @@ +--- +name: General question or documentation update +about: If you have a general question or documentation update suggestion around the resource module. +--- + diff --git a/.github/ISSUE_TEMPLATE/Problem_with_resource.md b/.github/ISSUE_TEMPLATE/Problem_with_resource.md new file mode 100644 index 0000000..35ac155 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/Problem_with_resource.md @@ -0,0 +1,61 @@ +--- +name: Problem with a resource +about: If you have a problem, bug, or enhancement with a resource in this resource module. +--- + +#### Details of the scenario you tried and the problem that is occurring + +#### Verbose logs showing the problem + +#### Suggested solution to the issue + +#### The DSC configuration that is used to reproduce the issue (as detailed as possible) +```powershell +# insert configuration here +``` + +#### The operating system the target node is running + + +#### Version and build of PowerShell the target node is running + + +#### Version of the DSC module that was used ('dev' if using current dev branch) + diff --git a/.github/ISSUE_TEMPLATE/Resource_proposal.md b/.github/ISSUE_TEMPLATE/Resource_proposal.md new file mode 100644 index 0000000..9f2a069 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/Resource_proposal.md @@ -0,0 +1,21 @@ +--- +name: New resource proposal +about: If you have a new resource proposal that you think should be added to this resource module. +--- + +### Description + +### Proposed properties + +### Special considerations or limitations diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..a8b3c49 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,50 @@ + +#### Pull Request (PR) description + + +#### This Pull Request (PR) fixes the following issues + + +#### Task list + +- [ ] Added an entry under the Unreleased section of the change log in the CHANGELOG.md. + Entry should say what was changed, and how that affects users (if applicable). +- [ ] Resource documentation added/updated in README.md. +- [ ] Resource parameter descriptions added/updated in README.md, schema.mof + and comment-based help. +- [ ] Comment-based help added/updated. +- [ ] Localization strings added/updated in all localization files as appropriate. +- [ ] Examples appropriately added/updated. +- [ ] Unit tests added/updated. See [DSC Resource Testing Guidelines](https://github.com/PowerShell/DscResources/blob/master/TestsGuidelines.md). +- [ ] Integration tests added/updated (where possible). See [DSC Resource Testing Guidelines](https://github.com/PowerShell/DscResources/blob/master/TestsGuidelines.md). +- [ ] New/changed code adheres to [DSC Resource Style Guidelines](https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md) and [Best Practices](https://github.com/PowerShell/DscResources/blob/master/BestPractices.md). diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b03606a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +DSCResource.Tests diff --git a/.vscode/analyzersettings.psd1 b/.vscode/analyzersettings.psd1 new file mode 100644 index 0000000..be415e4 --- /dev/null +++ b/.vscode/analyzersettings.psd1 @@ -0,0 +1,53 @@ +@{ + <# + For the custom rules to work, the DscResource.Tests repo must be + cloned. It is automatically clone as soon as any unit or + integration tests are run. + #> + CustomRulePath = '.\DSCResource.Tests\DscResource.AnalyzerRules' + + IncludeRules = @( + # DSC Resource Kit style guideline rules. + 'PSAvoidDefaultValueForMandatoryParameter', + 'PSAvoidDefaultValueSwitchParameter', + 'PSAvoidInvokingEmptyMembers', + 'PSAvoidNullOrEmptyHelpMessageAttribute', + 'PSAvoidUsingCmdletAliases', + 'PSAvoidUsingComputerNameHardcoded', + 'PSAvoidUsingDeprecatedManifestFields', + 'PSAvoidUsingEmptyCatchBlock', + 'PSAvoidUsingInvokeExpression', + 'PSAvoidUsingPositionalParameters', + 'PSAvoidShouldContinueWithoutForce', + 'PSAvoidUsingWMICmdlet', + 'PSAvoidUsingWriteHost', + 'PSDSCReturnCorrectTypesForDSCFunctions', + 'PSDSCStandardDSCFunctionsInResource', + 'PSDSCUseIdenticalMandatoryParametersForDSC', + 'PSDSCUseIdenticalParametersForDSC', + 'PSMisleadingBacktick', + 'PSMissingModuleManifestField', + 'PSPossibleIncorrectComparisonWithNull', + 'PSProvideCommentHelp', + 'PSReservedCmdletChar', + 'PSReservedParams', + 'PSUseApprovedVerbs', + 'PSUseCmdletCorrectly', + 'PSUseOutputTypeCorrectly', + 'PSAvoidGlobalVars', + 'PSAvoidUsingConvertToSecureStringWithPlainText', + 'PSAvoidUsingPlainTextForPassword', + 'PSAvoidUsingUsernameAndPasswordParams', + 'PSDSCUseVerboseMessageInDSCResource', + 'PSShouldProcess', + 'PSUseDeclaredVarsMoreThanAssignments', + 'PSUsePSCredentialType', + + <# + This is to test all the DSC Resource Kit custom rules. + The name of the function-blocks of each custom rule start + with 'Measure*'. + #> + 'Measure-*' + ) +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..0969e57 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,14 @@ +{ + "powershell.codeFormatting.openBraceOnSameLine": false, + "powershell.codeFormatting.newLineAfterOpenBrace": false, + "powershell.codeFormatting.newLineAfterCloseBrace": true, + "powershell.codeFormatting.whitespaceBeforeOpenBrace": true, + "powershell.codeFormatting.whitespaceBeforeOpenParen": true, + "powershell.codeFormatting.whitespaceAroundOperator": true, + "powershell.codeFormatting.whitespaceAfterSeparator": true, + "powershell.codeFormatting.ignoreOneLineBlock": false, + "powershell.codeFormatting.preset": "Custom", + "files.trimTrailingWhitespace": true, + "files.insertFinalNewline": true, + "powershell.scriptAnalysis.settingsPath": ".vscode\\analyzersettings.psd1" +} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..b7e3525 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,14 @@ +# Change log for UpdateServicesDsc + +## Unreleased + +- Update for HQRM standard +- Changes to Project layout + +## 1.0.75.0 + +- bug fixes + +## 1.0.72.0 + +- First release of UpdateServicesDsc diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..1d5c9ea --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,6 @@ +# Code of conduct + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional +questions or comments. diff --git a/TestsResults.xml b/TestsResults.xml new file mode 100644 index 0000000..9e39af8 --- /dev/null +++ b/TestsResults.xml @@ -0,0 +1,879 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Expected $null, but got Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic.DiagnosticRecord. + at <ScriptBlock>, C:\src\UpdateServicesDsc\DSCResource.Tests\Meta.Tests.ps1: line 499 +499: $requiredPssaRulesOutput | Should -Be $null + + + + + + + + + + + + + + + + + + Expected $null, but got @(Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic.DiagnosticRecord, Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic.DiagnosticRecord, Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic.DiagnosticRecord, Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic.DiagnosticRecord). + at <ScriptBlock>, C:\src\UpdateServicesDsc\DSCResource.Tests\Meta.Tests.ps1: line 577 +577: $customPssaRulesOutput | Should -Be $null + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/UpdateServicesDsc.psd1 b/UpdateServicesDsc.psd1 index 053b584..f1ebd05 100644 --- a/UpdateServicesDsc.psd1 +++ b/UpdateServicesDsc.psd1 @@ -81,7 +81,7 @@ CmdletsToExport = @() AliasesToExport = @() # DSC resources to export from this module -DscResourcesToExport = 'UpdateServicesApprovalRule', 'UpdateServicesCleanup', +DscResourcesToExport = 'UpdateServicesApprovalRule', 'UpdateServicesCleanup', 'UpdateServicesServer' # List of all modules packaged with this module @@ -96,7 +96,7 @@ PrivateData = @{ PSData = @{ # Tags applied to this module. These help with module discovery in online galleries. - Tags = 'DSCResource','WSUS' + Tags = 'DSCResource','WSUS','DSCResourceKit' # A URL to the license for this module. LicenseUri = 'https://github.com/mgreenegit/UpdateServicesDsc/blob/master/LICENSE' @@ -114,7 +114,7 @@ PrivateData = @{ # ExternalModuleDependencies = '' } # End of PSData hashtable - + } # End of PrivateData hashtable # HelpInfo URI of this module @@ -124,4 +124,3 @@ PrivateData = @{ # DefaultCommandPrefix = '' } - From e96ec9c7b52d6bf3671bdf3dd3f12e0b74f39b60 Mon Sep 17 00:00:00 2001 From: gaelcolas Date: Mon, 11 Mar 2019 13:22:49 +0800 Subject: [PATCH 6/7] removing offending testsResults.xml --- TestsResults.xml | 879 ----------------------------------------------- 1 file changed, 879 deletions(-) delete mode 100644 TestsResults.xml diff --git a/TestsResults.xml b/TestsResults.xml deleted file mode 100644 index 9e39af8..0000000 --- a/TestsResults.xml +++ /dev/null @@ -1,879 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Expected $null, but got Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic.DiagnosticRecord. - at <ScriptBlock>, C:\src\UpdateServicesDsc\DSCResource.Tests\Meta.Tests.ps1: line 499 -499: $requiredPssaRulesOutput | Should -Be $null - - - - - - - - - - - - - - - - - - Expected $null, but got @(Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic.DiagnosticRecord, Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic.DiagnosticRecord, Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic.DiagnosticRecord, Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic.DiagnosticRecord). - at <ScriptBlock>, C:\src\UpdateServicesDsc\DSCResource.Tests\Meta.Tests.ps1: line 577 -577: $customPssaRulesOutput | Should -Be $null - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From 645c429ba2a408c09394490f0a9aa59ee17234e9 Mon Sep 17 00:00:00 2001 From: gaelcolas Date: Mon, 11 Mar 2019 13:24:45 +0800 Subject: [PATCH 7/7] fixing braces position --- .../MSFT_UpdateServicesCleanup.psm1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/DSCResources/MSFT_UpdateServicesCleanup/MSFT_UpdateServicesCleanup.psm1 b/DSCResources/MSFT_UpdateServicesCleanup/MSFT_UpdateServicesCleanup.psm1 index 7d9b7da..ca3cd41 100644 --- a/DSCResources/MSFT_UpdateServicesCleanup/MSFT_UpdateServicesCleanup.psm1 +++ b/DSCResources/MSFT_UpdateServicesCleanup/MSFT_UpdateServicesCleanup.psm1 @@ -50,12 +50,14 @@ function Get-TargetResource "CleanupUnneededContentFiles", "CleanupLocalPublishedContentFiles" ) - foreach ($Var in $Arguments) { + foreach ($Var in $Arguments) + { $regex = [regex]'^\$(?.*)\s=\s\$(?.*)$' $groups = $regex.Match($Var).Groups $VarName = $groups['name'].value.Trim() $VarValueString = $groups['value'].value.Trim() - if($VarName -in $ArgumentNames) { + if($VarName -in $ArgumentNames) + { Set-variable -Name $VarName -Value $ExecutionContext.InvokeCommand.ExpandString($VarValueString) } }