Skip to content

Commit

Permalink
OfficeOnlineServerDSC: Import DscResource.Common module (#68)
Browse files Browse the repository at this point in the history
- OfficeOnlineServerDsc
  - Imports DscResource.Common module
- OfficeOnlineServerDsc
  - All resources
    - Get-LocalizedData from DscResource.Common is now used
  • Loading branch information
JonasCassier committed Nov 19, 2023
1 parent 7358992 commit 869fff3
Show file tree
Hide file tree
Showing 9 changed files with 179 additions and 209 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Expand Up @@ -5,10 +5,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- OfficeOnlineServerDsc
- Imports DscResource.Common module

### Changed

- OfficeOnlineServerDsc
- Updated to latest pipeline files.
- All resources
- Get-LocalizedData from DscResource.Common is now used

## [1.5.0] - 2020-04-03

Expand Down
3 changes: 3 additions & 0 deletions RequiredModules.psd1
Expand Up @@ -21,4 +21,7 @@
xDscResourceDesigner = 'latest'
'DscResource.DocGenerator' = 'latest'
PSDscResources = 'latest'

# Build dependencies needed for using the module
'DscResource.Common' = 'latest'
}
13 changes: 13 additions & 0 deletions build.yaml
Expand Up @@ -43,13 +43,25 @@ BuildWorkflow:
- Publish_Release_To_GitHub
- Publish_GitHub_Wiki_Content

####################################################
# ModuleBuilder Dependent Modules Configuration #
####################################################

NestedModule:
DscResource.Common:
CopyOnly: true
Path: ./output/RequiredModules/DscResource.Common
AddToManifest: false
Exclude: PSGetModuleInfo.xml

####################################################
# PESTER Configuration #
####################################################

Pester:
OutputFormat: NUnitXML
ExcludeFromCodeCoverage:
- Modules/DscResource.Common
Script:
- tests/Unit
ExcludeTag:
Expand All @@ -76,6 +88,7 @@ DscTest:
ExcludeSourceFile:
- output
ExcludeModuleFile:
- Modules/DscResource.Common
MainGitBranch: master

ModuleBuildTasks:
Expand Down

Large diffs are not rendered by default.

@@ -1,9 +1,10 @@
$script:resourceModulePath = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent
$script:modulesFolderPath = Join-Path -Path $script:resourceModulePath -ChildPath 'Modules'
$script:resourceHelperModulePath = Join-Path -Path $script:modulesFolderPath -ChildPath 'OfficeOnlineServerDsc.Util'
Import-Module -Name (Join-Path -Path $script:resourceHelperModulePath -ChildPath 'OfficeOnlineServerDsc.Util.psm1')
$script:resourceHelperModulePath = @(
(Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\OfficeOnlineServerDsc.Util'),
(Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common')
)
Import-Module -Name $script:resourceHelperModulePath

$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_OfficeOnlineServerInstall'
$script:localizedData = Get-LocalizedData -DefaultUICulture 'en-US'

$Script:UninstallPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
$script:InstallKeyPattern = "Office1(5)|(6).WacServer"
Expand Down
@@ -1,9 +1,10 @@
$script:resourceModulePath = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent
$script:modulesFolderPath = Join-Path -Path $script:resourceModulePath -ChildPath 'Modules'
$script:resourceHelperModulePath = Join-Path -Path $script:modulesFolderPath -ChildPath 'OfficeOnlineServerDsc.Util'
Import-Module -Name (Join-Path -Path $script:resourceHelperModulePath -ChildPath 'OfficeOnlineServerDsc.Util.psm1')
$script:resourceHelperModulePath = @(
(Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\OfficeOnlineServerDsc.Util'),
(Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common')
)
Import-Module -Name $script:resourceHelperModulePath

$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_OfficeOnlineServerInstallLanguagePack'
$script:localizedData = Get-LocalizedData -DefaultUICulture 'en-US'

$Script:UninstallPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
$script:InstallKeyPattern = "Office1(5)|(6).WacServerLpk."
Expand Down
@@ -1,9 +1,10 @@
$script:resourceModulePath = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent
$script:modulesFolderPath = Join-Path -Path $script:resourceModulePath -ChildPath 'Modules'
$script:resourceHelperModulePath = Join-Path -Path $script:modulesFolderPath -ChildPath 'OfficeOnlineServerDsc.Util'
Import-Module -Name (Join-Path -Path $script:resourceHelperModulePath -ChildPath 'OfficeOnlineServerDsc.Util.psm1')
$script:resourceHelperModulePath = @(
(Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\OfficeOnlineServerDsc.Util'),
(Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common')
)
Import-Module -Name $script:resourceHelperModulePath

$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_OfficeOnlineServerMachine'
$script:localizedData = Get-LocalizedData -DefaultUICulture 'en-US'

$script:OOSDscRegKey = "HKLM:\SOFTWARE\OOSDsc"

Expand Down
@@ -1,9 +1,10 @@
$script:resourceModulePath = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent
$script:modulesFolderPath = Join-Path -Path $script:resourceModulePath -ChildPath 'Modules'
$script:resourceHelperModulePath = Join-Path -Path $script:modulesFolderPath -ChildPath 'OfficeOnlineServerDsc.Util'
Import-Module -Name (Join-Path -Path $script:resourceHelperModulePath -ChildPath 'OfficeOnlineServerDsc.Util.psm1')
$script:resourceHelperModulePath = @(
(Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\OfficeOnlineServerDsc.Util'),
(Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common')
)
Import-Module -Name $script:resourceHelperModulePath

$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_OfficeOnlineServerProductUpdate'
$script:localizedData = Get-LocalizedData -DefaultUICulture 'en-US'

$script:OOSDscRegKey = "HKLM:\SOFTWARE\OOSDsc"

Expand Down
Expand Up @@ -135,67 +135,6 @@ function Convert-OOSDscCIMInstanceToString
return $str
}

<#
.SYNOPSIS
Retrieves the localized string data based on the machine's culture.
Falls back to en-US strings if the machine's culture is not supported.
.PARAMETER ResourceName
The name of the resource as it appears before '.strings.psd1' of the localized string file.
For example:
For WindowsOptionalFeature: MSFT_WindowsOptionalFeature
For Service: MSFT_ServiceResource
For Registry: MSFT_RegistryResource
For Helper: SqlServerDscHelper
.PARAMETER ScriptRoot
Optional. The root path where to expect to find the culture folder. This is only needed
for localization in helper modules. This should not normally be used for resources.
.NOTES
To be able to use localization in the helper function, this function must
be first in the file, before Get-LocalizedData is used by itself to load
localized data for this helper module (see directly after this function).
#>
function Get-LocalizedData
{
[CmdletBinding()]
param
(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.String]
$ResourceName,

[Parameter()]
[ValidateNotNullOrEmpty()]
[System.String]
$ScriptRoot
)

if (-not $ScriptRoot)
{
$dscResourcesFolder = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'DSCResources'
$resourceDirectory = Join-Path -Path $dscResourcesFolder -ChildPath $ResourceName
}
else
{
$resourceDirectory = $ScriptRoot
}

$localizedStringFileLocation = Join-Path -Path $resourceDirectory -ChildPath $PSUICulture

if (-not (Test-Path -Path $localizedStringFileLocation))
{
# Fallback to en-US
$localizedStringFileLocation = Join-Path -Path $resourceDirectory -ChildPath 'en-US'
}

Import-LocalizedData `
-BindingVariable 'localizedData' `
-FileName "$ResourceName.strings.psd1" `
-BaseDirectory $localizedStringFileLocation

return $localizedData
}

<#
.SYNOPSIS
Expand All @@ -209,13 +148,13 @@ function Get-OosDscInstalledProductVersion
param ()

return Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | `
Select-Object DisplayName, DisplayVersion | `
Where-Object {
$_.DisplayName -eq "Microsoft Office Web Apps Server 2013" -or `
$_.DisplayName -eq "Microsoft Office Online Server"
} | ForEach-Object -Process {
return [Version]::Parse($_.DisplayVersion)
} | Select-Object -First 1
Select-Object DisplayName, DisplayVersion | `
Where-Object {
$_.DisplayName -eq "Microsoft Office Web Apps Server 2013" -or `
$_.DisplayName -eq "Microsoft Office Online Server"
} | ForEach-Object -Process {
return [Version]::Parse($_.DisplayVersion)
} | Select-Object -First 1
}


Expand Down

0 comments on commit 869fff3

Please sign in to comment.