From 514acc41d316caf6feb48ee58be93386b01c2575 Mon Sep 17 00:00:00 2001 From: Daniel Siegenthaler Date: Thu, 3 Oct 2019 19:43:25 +0200 Subject: [PATCH 1/4] xIisLogging: Moving strings to localization file --- .../MSFT_xIisLogging/MSFT_xIisLogging.psm1 | 28 ++----------------- .../en-US/MSFT_xIisLogging.strings.psd1 | 21 ++++++++++++++ 2 files changed, 23 insertions(+), 26 deletions(-) create mode 100644 DSCResources/MSFT_xIisLogging/en-US/MSFT_xIisLogging.strings.psd1 diff --git a/DSCResources/MSFT_xIisLogging/MSFT_xIisLogging.psm1 b/DSCResources/MSFT_xIisLogging/MSFT_xIisLogging.psm1 index f6a6ceaf4..a394ed669 100644 --- a/DSCResources/MSFT_xIisLogging/MSFT_xIisLogging.psm1 +++ b/DSCResources/MSFT_xIisLogging/MSFT_xIisLogging.psm1 @@ -4,32 +4,8 @@ $script:localizationModulePath = Join-Path -Path $script:modulesFolderPath -Chil Import-Module -Name (Join-Path -Path $script:localizationModulePath -ChildPath 'xWebAdministration.Common.psm1') -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData -StringData @' - VerboseGetTargetResult = Get-TargetResource has been run. - VerboseSetTargetUpdateLogPath = LogPath is not in the desired state and will be updated. - VerboseSetTargetUpdateLogFlags = LogFlags do not match and will be updated. - VerboseSetTargetUpdateLogPeriod = LogPeriod is not in the desired state and will be updated. - VerboseSetTargetUpdateLogTruncateSize = TruncateSize is not in the desired state and will be updated. - VerboseSetTargetUpdateLoglocalTimeRollover = LoglocalTimeRollover is not in the desired state and will be updated. - VerboseSetTargetUpdateLogFormat = LogFormat is not in the desired state and will be updated - VerboseSetTargetUpdateLogTargetW3C = LogTargetW3C is not in the desired state and will be updated - VerboseSetTargetUpdateLogCustomFields = LogCustomFields is not in the desired state and will be updated. - VerboseTestTargetUpdateLogCustomFields = LogCustomFields is not in the desired state and will be updated. - VerboseTestTargetFalseLogPath = LogPath does match desired state. - VerboseTestTargetFalseLogFlags = LogFlags does not match desired state. - VerboseTestTargetFalseLogPeriod = LogPeriod does not match desired state. - VerboseTestTargetFalseLogTruncateSize = LogTruncateSize does not match desired state. - VerboseTestTargetFalseLoglocalTimeRollover = LoglocalTimeRollover does not match desired state. - VerboseTestTargetFalseLogFormat = LogFormat does not match desired state. - VerboseTestTargetFalseLogTargetW3C = LogTargetW3C does not match desired state. - WarningLogPeriod = LogTruncateSize has is an input as will overwrite this desired state. - WarningIncorrectLogFormat = LogFormat is not W3C, as a result LogFlags will not be used. -'@ -} +# Import Localization Strings +$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_xIisLogging' <# .SYNOPSIS diff --git a/DSCResources/MSFT_xIisLogging/en-US/MSFT_xIisLogging.strings.psd1 b/DSCResources/MSFT_xIisLogging/en-US/MSFT_xIisLogging.strings.psd1 new file mode 100644 index 000000000..7a78cce6b --- /dev/null +++ b/DSCResources/MSFT_xIisLogging/en-US/MSFT_xIisLogging.strings.psd1 @@ -0,0 +1,21 @@ +ConvertFrom-StringData @' + VerboseGetTargetResult = Get-TargetResource has been run. + VerboseSetTargetUpdateLogPath = LogPath is not in the desired state and will be updated. + VerboseSetTargetUpdateLogFlags = LogFlags do not match and will be updated. + VerboseSetTargetUpdateLogPeriod = LogPeriod is not in the desired state and will be updated. + VerboseSetTargetUpdateLogTruncateSize = TruncateSize is not in the desired state and will be updated. + VerboseSetTargetUpdateLoglocalTimeRollover = LoglocalTimeRollover is not in the desired state and will be updated. + VerboseSetTargetUpdateLogFormat = LogFormat is not in the desired state and will be updated + VerboseSetTargetUpdateLogTargetW3C = LogTargetW3C is not in the desired state and will be updated + VerboseSetTargetUpdateLogCustomFields = LogCustomFields is not in the desired state and will be updated. + VerboseTestTargetUpdateLogCustomFields = LogCustomFields is not in the desired state and will be updated. + VerboseTestTargetFalseLogPath = LogPath does match desired state. + VerboseTestTargetFalseLogFlags = LogFlags does not match desired state. + VerboseTestTargetFalseLogPeriod = LogPeriod does not match desired state. + VerboseTestTargetFalseLogTruncateSize = LogTruncateSize does not match desired state. + VerboseTestTargetFalseLoglocalTimeRollover = LoglocalTimeRollover does not match desired state. + VerboseTestTargetFalseLogFormat = LogFormat does not match desired state. + VerboseTestTargetFalseLogTargetW3C = LogTargetW3C does not match desired state. + WarningLogPeriod = LogTruncateSize has is an input as will overwrite this desired state. + WarningIncorrectLogFormat = LogFormat is not W3C, as a result LogFlags will not be used. +'@ From 48c2808442e1f50a70ddb91908c42fd8ec618c64 Mon Sep 17 00:00:00 2001 From: Daniel Siegenthaler Date: Sat, 5 Oct 2019 10:39:55 +0200 Subject: [PATCH 2/4] Fix review comment --- CHANGELOG.md | 1 + .../MSFT_xIisLogging/MSFT_xIisLogging.psm1 | 42 +++++++++---------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1154d7b77..6f390f02c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Unreleased - Changes to xWebAdministration + - Moved MSFT_xIisLogging localization strings to strings.psd1. - Resolved custom Script Analyzer rules that was added to the test framework. - Moved change log from README.md to a separate CHANGELOG.md ([issue #446](https://github.com/PowerShell/xWebAdministration/issues/446)). - Remove example 'Creating the default website using configuration data' from README.md ([issue #488](https://github.com/PowerShell/xWebAdministration/issues/488)). diff --git a/DSCResources/MSFT_xIisLogging/MSFT_xIisLogging.psm1 b/DSCResources/MSFT_xIisLogging/MSFT_xIisLogging.psm1 index a394ed669..139c0c515 100644 --- a/DSCResources/MSFT_xIisLogging/MSFT_xIisLogging.psm1 +++ b/DSCResources/MSFT_xIisLogging/MSFT_xIisLogging.psm1 @@ -26,7 +26,7 @@ function Get-TargetResource $currentLogSettings = Get-WebConfiguration ` -filter '/system.applicationHost/sites/siteDefaults/Logfile' - Write-Verbose -Message ($LocalizedData.VerboseGetTargetResult) + Write-Verbose -Message ($script:localizedData.VerboseGetTargetResult) $cimLogCustomFields = @(ConvertTo-CimLogCustomFields -InputObject $currentLogSettings.logFile.customFields.Collection) @@ -128,7 +128,7 @@ function Set-TargetResource if ($PSBoundParameters.ContainsKey('LogFormat') -and ` ($LogFormat -ne $currentLogState.LogFormat)) { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdateLogFormat) + Write-Verbose -Message ($script:localizedData.VerboseSetTargetUpdateLogFormat) Set-WebConfigurationProperty '/system.applicationHost/sites/siteDefaults/logfile' ` -Name logFormat ` -Value $LogFormat @@ -137,7 +137,7 @@ function Set-TargetResource # Update LogPath if needed if ($PSBoundParameters.ContainsKey('LogPath') -and ($LogPath -ne $currentLogState.LogPath)) { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdateLogPath) + Write-Verbose -Message ($script:localizedData.VerboseSetTargetUpdateLogPath) Set-WebConfigurationProperty '/system.applicationHost/sites/siteDefaults/logfile' ` -Name directory ` -Value $LogPath @@ -147,7 +147,7 @@ function Set-TargetResource if ($PSBoundParameters.ContainsKey('LogFlags') -and ` (-not (Compare-LogFlags -LogFlags $LogFlags))) { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdateLogFlags) + Write-Verbose -Message ($script:localizedData.VerboseSetTargetUpdateLogFlags) Set-WebConfigurationProperty '/system.Applicationhost/Sites/SiteDefaults/logfile' ` -Name logFormat ` -Value 'W3C' @@ -162,9 +162,9 @@ function Set-TargetResource { if ($PSBoundParameters.ContainsKey('LogTruncateSize')) { - Write-Verbose -Message ($LocalizedData.WarningLogPeriod) + Write-Verbose -Message ($script:localizedData.WarningLogPeriod) } - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdateLogPeriod) + Write-Verbose -Message ($script:localizedData.VerboseSetTargetUpdateLogPeriod) Set-WebConfigurationProperty '/system.Applicationhost/Sites/SiteDefaults/logfile' ` -Name period ` -Value $LogPeriod @@ -174,7 +174,7 @@ function Set-TargetResource if ($PSBoundParameters.ContainsKey('LogTruncateSize') -and ` ($LogTruncateSize -ne $currentLogState.LogTruncateSize)) { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdateLogTruncateSize) + Write-Verbose -Message ($script:localizedData.VerboseSetTargetUpdateLogTruncateSize) Set-WebConfigurationProperty '/system.Applicationhost/Sites/SiteDefaults/logfile' ` -Name truncateSize ` -Value $LogTruncateSize @@ -188,7 +188,7 @@ function Set-TargetResource ($LoglocalTimeRollover -ne ` ([System.Convert]::ToBoolean($currentLogState.LoglocalTimeRollover)))) { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdateLoglocalTimeRollover) + Write-Verbose -Message ($script:localizedData.VerboseSetTargetUpdateLoglocalTimeRollover) Set-WebConfigurationProperty '/system.Applicationhost/Sites/SiteDefaults/logfile' ` -Name localTimeRollover ` -Value $LoglocalTimeRollover @@ -198,7 +198,7 @@ function Set-TargetResource if ($PSBoundParameters.ContainsKey('LogTargetW3C') -and ` ($LogTargetW3C -ne $currentLogState.LogTargetW3C)) { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdateLogTargetW3C) + Write-Verbose -Message ($script:localizedData.VerboseSetTargetUpdateLogTargetW3C) Set-WebConfigurationProperty '/system.applicationHost/sites/siteDefaults/logfile' ` -Name logTargetW3C ` -Value $LogTargetW3C @@ -208,7 +208,7 @@ function Set-TargetResource if ($PSBoundParameters.ContainsKey('LogCustomFields') -and ` (-not (Test-LogCustomField -LogCustomField $LogCustomFields))) { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdateLogCustomFields) + Write-Verbose -Message ($script:localizedData.VerboseSetTargetUpdateLogCustomFields) Set-LogCustomField -LogCustomField $LogCustomFields } @@ -299,20 +299,20 @@ function Test-TargetResource if ($PSBoundParameters.ContainsKey('LogFlags') -and ` $LogFormat -ne 'W3C') { - Write-Verbose -Message ($LocalizedData.WarningIncorrectLogFormat) + Write-Verbose -Message ($script:localizedData.WarningIncorrectLogFormat) } # Warn if LogFlags are passed in and Desired LogFormat is not W3C if ($PSBoundParameters.ContainsKey('LogFlags') -and ` $currentLogState.LogFormat -ne 'W3C') { - Write-Verbose -Message ($LocalizedData.WarningIncorrectLogFormat) + Write-Verbose -Message ($script:localizedData.WarningIncorrectLogFormat) } # Check LogFormat if ($LogFormat -ne $currentLogState.LogFormat) { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseLogFormat) + Write-Verbose -Message ($script:localizedData.VerboseTestTargetFalseLogFormat) return $false } } @@ -321,7 +321,7 @@ function Test-TargetResource if ($PSBoundParameters.ContainsKey('LogFlags') -and ` (-not (Compare-LogFlags -LogFlags $LogFlags))) { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseLogFlags) + Write-Verbose -Message ($script:localizedData.VerboseTestTargetFalseLogFlags) return $false } @@ -329,7 +329,7 @@ function Test-TargetResource if ($PSBoundParameters.ContainsKey('LogPath') -and ` ($LogPath -ne $currentLogState.LogPath)) { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseLogPath) + Write-Verbose -Message ($script:localizedData.VerboseTestTargetFalseLogPath) return $false } @@ -339,10 +339,10 @@ function Test-TargetResource { if ($PSBoundParameters.ContainsKey('LogTruncateSize')) { - Write-Verbose -Message ($LocalizedData.WarningLogPeriod) + Write-Verbose -Message ($script:localizedData.WarningLogPeriod) } - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseLogPeriod) + Write-Verbose -Message ($script:localizedData.VerboseTestTargetFalseLogPeriod) return $false } @@ -350,7 +350,7 @@ function Test-TargetResource if ($PSBoundParameters.ContainsKey('LogTruncateSize') -and ` ($LogTruncateSize -ne $currentLogState.LogTruncateSize)) { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseLogTruncateSize) + Write-Verbose -Message ($script:localizedData.VerboseTestTargetFalseLogTruncateSize) return $false } @@ -359,7 +359,7 @@ function Test-TargetResource ($LoglocalTimeRollover -ne ` ([System.Convert]::ToBoolean($currentLogState.LoglocalTimeRollover)))) { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseLoglocalTimeRollover) + Write-Verbose -Message ($script:localizedData.VerboseTestTargetFalseLoglocalTimeRollover) return $false } @@ -367,7 +367,7 @@ function Test-TargetResource if ($PSBoundParameters.ContainsKey('LogTargetW3C') -and ` ($LogTargetW3C -ne $currentLogState.LogTargetW3C)) { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseLogTargetW3C) + Write-Verbose -Message ($script:localizedData.VerboseTestTargetFalseLogTargetW3C) return $false } @@ -375,7 +375,7 @@ function Test-TargetResource if ($PSBoundParameters.ContainsKey('LogCustomFields') -and ` (-not (Test-LogCustomField -LogCustomFields $LogCustomFields))) { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetUpdateLogCustomFields) + Write-Verbose -Message ($script:localizedData.VerboseTestTargetUpdateLogCustomFields) return $false } From 36329ea2e906b22e9ec84fbcafdc295e3b7e128a Mon Sep 17 00:00:00 2001 From: Daniel Siegenthaler Date: Sun, 6 Oct 2019 09:23:00 +0200 Subject: [PATCH 3/4] Fixing Changelog entry --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f390f02c..824859963 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,9 @@ ## Unreleased +- Changes to xIisHandler + - Moved MSFT_xIisLogging localization strings to strings.psd1 ([issue #463](https://github.com/PowerShell/xWebAdministration/issues/463)). - Changes to xWebAdministration - - Moved MSFT_xIisLogging localization strings to strings.psd1. - Resolved custom Script Analyzer rules that was added to the test framework. - Moved change log from README.md to a separate CHANGELOG.md ([issue #446](https://github.com/PowerShell/xWebAdministration/issues/446)). - Remove example 'Creating the default website using configuration data' from README.md ([issue #488](https://github.com/PowerShell/xWebAdministration/issues/488)). From 645da3992acd58a58baf85e36443275ab842410c Mon Sep 17 00:00:00 2001 From: Daniel Siegenthaler Date: Sun, 6 Oct 2019 09:27:47 +0200 Subject: [PATCH 4/4] Change issue number --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 824859963..870cd24e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,8 @@ ## Unreleased -- Changes to xIisHandler - - Moved MSFT_xIisLogging localization strings to strings.psd1 ([issue #463](https://github.com/PowerShell/xWebAdministration/issues/463)). +- Changes to xIisLogging + - Moved MSFT_xIisLogging localization strings to strings.psd1 ([issue #464](https://github.com/PowerShell/xWebAdministration/issues/464)). - Changes to xWebAdministration - Resolved custom Script Analyzer rules that was added to the test framework. - Moved change log from README.md to a separate CHANGELOG.md ([issue #446](https://github.com/PowerShell/xWebAdministration/issues/446)).