Skip to content

Commit

Permalink
Merge pull request #1103 from PowerShell/release-3.6
Browse files Browse the repository at this point in the history
Release 3.6
  • Loading branch information
mgreenegit authored Aug 7, 2019
2 parents d714e5b + b313dc6 commit 4a720ae
Show file tree
Hide file tree
Showing 384 changed files with 24,070 additions and 22,439 deletions.
32 changes: 32 additions & 0 deletions .vscode/GetTestCoverage.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
[string]
$UnitTestFilePath,

[Parameter(Mandatory = $true)]
[string]
$SharePointCmdletModule = (Join-Path -Path $PSScriptRoot `
-ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" `
-Resolve)
)

if ($UnitTestFilePath.EndsWith("Tests.ps1"))
{

$pesterParameters = @{
Path = $unitTestFilePath
Parameters = @{
SharePointCmdletModule = $SharePointCmdletModule
}
}

$unitTest = Get-Item -Path $UnitTestFilePath
$unitTestName = "$($unitTest.Name.Split('.')[1])"

$unitTestFilePath = (Join-Path -Path $PSScriptRoot `
-ChildPath "..\Modules\SharePointDsc\DSCResources\MSFT_$($unitTestName)\MSFT_$($unitTestName).psm1" `
-Resolve)

Invoke-Pester -Script $pesterParameters -CodeCoverage $UnitTestFilePath -Verbose
}
33 changes: 33 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,39 @@
"cwd": "${file}",
"createTemporaryIntegratedConsole": true
},
{
"type": "PowerShell",
"request": "launch",
"name": "Get current unit test code overage (SP2013)",
"script": "${workspaceRoot}/.vscode/GetTestCoverage.ps1",
"args": [
"${file}",
"${workspaceRoot}/Tests/Unit/Stubs/SharePoint/15.0.4805.1000/Microsoft.SharePoint.PowerShell.psm1"
],
"createTemporaryIntegratedConsole": true
},
{
"type": "PowerShell",
"request": "launch",
"name": "Get current unit test code overage (SP2016)",
"script": "${workspaceRoot}/.vscode/GetTestCoverage.ps1",
"args": [
"${file}",
"${workspaceRoot}/Tests/Unit/Stubs/SharePoint/16.0.4456.1000/Microsoft.SharePoint.PowerShell.psm1"
],
"createTemporaryIntegratedConsole": true
},
{
"type": "PowerShell",
"request": "launch",
"name": "Get current unit test code overage (SP2019)",
"script": "${workspaceRoot}/.vscode/GetTestCoverage.ps1",
"args": [
"${file}",
"${workspaceRoot}/Tests/Unit/Stubs/SharePoint/16.0.10337.12109/Microsoft.SharePoint.PowerShell.psm1"
],
"createTemporaryIntegratedConsole": true
},
{
"name": "Debug current file",
"type": "PowerShell",
Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Change log for SharePointDsc

## v3.6

* SharePointDsc generic
* Added new launch actions to vscode to allow code coverage reports for
the current unit test file.
* SPFarm
* Moved check for CentralAdministrationUrl is HTTP to Set method,
to prevent issues with ReverseDsc.
* SPInstall
* Updated error code checks to force reboot.
* SPProductUpdate
* Fixes an issue using ShutdownServices when no Farm is available.
* SPTrustedRootAuthority
* Fixes issue where Set method throws an error because the
parameter CertificateFilePath is not read correctly.
* SPTrustedSecurityTokenIssuer
* New resource for configuring OAuth trusts

## v3.5

* SharePointDsc generic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function Get-TargetResource
$DatabaseServer,

[Parameter()]
[ValidateSet("Present","Absent")]
[ValidateSet("Present", "Absent")]
[System.String]
$Ensure = "Present",

Expand All @@ -29,17 +29,17 @@ function Get-TargetResource
Write-Verbose -Message "Getting Access Services service app '$Name'"

$result = Invoke-SPDscCommand -Credential $InstallAccount `
-Arguments $PSBoundParameters `
-ScriptBlock {
-Arguments $PSBoundParameters `
-ScriptBlock {
$params = $args[0]

$serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue
$nullReturn = @{
Name = $params.Name
Name = $params.Name
ApplicationPool = $params.ApplicationPool
DatabaseServer = $params.DatabaseServer
Ensure = "Absent"
InstallAccount = $params.InstallAccount
DatabaseServer = $params.DatabaseServer
Ensure = "Absent"
InstallAccount = $params.InstallAccount
}
if ($null -eq $serviceApps)
{
Expand All @@ -59,10 +59,10 @@ function Get-TargetResource
$context = [Microsoft.SharePoint.SPServiceContext]::GetContext($serviceApp.ServiceApplicationProxyGroup, [Microsoft.SharePoint.SPSiteSubscriptionIdentifier]::Default)
$dbserver = (Get-SPAccessServicesDatabaseServer $context).ServerName
return @{
Name = $serviceApp.DisplayName
DatabaseServer = $dbserver
Name = $serviceApp.DisplayName
DatabaseServer = $dbserver
ApplicationPool = $serviceApp.ApplicationPool.Name
Ensure = "Present"
Ensure = "Present"
}
}
}
Expand All @@ -87,7 +87,7 @@ function Set-TargetResource
$DatabaseServer,

[Parameter()]
[ValidateSet("Present","Absent")]
[ValidateSet("Present", "Absent")]
[System.String]
$Ensure = "Present",

Expand All @@ -104,15 +104,15 @@ function Set-TargetResource
{
Write-Verbose -Message "Creating Access Services Application $Name"
Invoke-SPDscCommand -Credential $InstallAccount `
-Arguments $PSBoundParameters `
-ScriptBlock {
-Arguments $PSBoundParameters `
-ScriptBlock {

$params = $args[0]

$app = New-SPAccessServicesApplication -Name $params.Name `
-ApplicationPool $params.ApplicationPool `
-Default `
-DatabaseServer $params.DatabaseServer
-ApplicationPool $params.ApplicationPool `
-Default `
-DatabaseServer $params.DatabaseServer

$app | New-SPAccessServicesApplicationProxy | Out-Null
}
Expand All @@ -121,8 +121,8 @@ function Set-TargetResource
{
Write-Verbose -Message "Removing Access Service Application $Name"
Invoke-SPDscCommand -Credential $InstallAccount `
-Arguments $PSBoundParameters `
-ScriptBlock {
-Arguments $PSBoundParameters `
-ScriptBlock {

$params = $args[0]

Expand Down Expand Up @@ -163,7 +163,7 @@ function Test-TargetResource
$DatabaseServer,

[Parameter()]
[ValidateSet("Present","Absent")]
[ValidateSet("Present", "Absent")]
[System.String]
$Ensure = "Present",

Expand All @@ -184,14 +184,14 @@ function Test-TargetResource
if ($CurrentValues.DatabaseServer -ne $DatabaseServer)
{
Write-Verbose -Message ("Specified database server does not match the actual " + `
"database server. This resource cannot move the database " + `
"to a different SQL instance.")
"database server. This resource cannot move the database " + `
"to a different SQL instance.")
return $false
}

return Test-SPDscParameterState -CurrentValues $CurrentValues `
-DesiredValues $PSBoundParameters `
-ValuesToCheck @("Ensure")
-DesiredValues $PSBoundParameters `
-ValuesToCheck @("Ensure")
}

Export-ModuleMember -Function *-TargetResource
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function Get-TargetResource
$ApplicationPool,

[Parameter()]
[ValidateSet("Present","Absent")]
[ValidateSet("Present", "Absent")]
[System.String]
$Ensure = "Present",

Expand All @@ -25,15 +25,15 @@ function Get-TargetResource
Write-Verbose -Message "Getting Access 2010 Service app '$Name'"

$result = Invoke-SPDscCommand -Credential $InstallAccount `
-Arguments $PSBoundParameters `
-ScriptBlock {
-Arguments $PSBoundParameters `
-ScriptBlock {
$params = $args[0]
$serviceApps = Get-SPServiceApplication -Name $params.Name `
-ErrorAction SilentlyContinue
-ErrorAction SilentlyContinue
$nullReturn = @{
Name = $params.Name
Name = $params.Name
ApplicationPool = $params.ApplicationPool
Ensure = "Absent"
Ensure = "Absent"
}
if ($null -eq $serviceApps)
{
Expand All @@ -51,14 +51,14 @@ function Get-TargetResource
else
{
return @{
Name = $serviceApp.DisplayName
Name = $serviceApp.DisplayName
ApplicationPool = $serviceApp.ApplicationPool.Name
Ensure = "Present"
InstallAccount = $params.InstallAccount
Ensure = "Present"
InstallAccount = $params.InstallAccount
}
}
}
return $result
return $result
}

function Set-TargetResource
Expand All @@ -75,7 +75,7 @@ function Set-TargetResource
$ApplicationPool,

[Parameter()]
[ValidateSet("Present","Absent")]
[ValidateSet("Present", "Absent")]
[System.String]
$Ensure = "Present",

Expand All @@ -91,26 +91,26 @@ function Set-TargetResource
{
Write-Verbose "Creating Access 2010 Service Application '$Name'"
Invoke-SPDscCommand -Credential $InstallAccount `
-Arguments $PSBoundParameters `
-ScriptBlock {
-Arguments $PSBoundParameters `
-ScriptBlock {
$params = $args[0]
$accessApp = New-SPAccessServiceApplication -Name $params.Name `
-ApplicationPool $params.ApplicationPool
-ApplicationPool $params.ApplicationPool
}
}
if ($result.Ensure -eq "Present" -and $Ensure -eq "Present")
{
Write-Verbose "Updating Access 2010 service application '$Name'"
Invoke-SPDscCommand -Credential $InstallAccount `
-Arguments $PSBoundParameters `
-ScriptBlock {
$params = $args[0]
$apps = Get-SPServiceApplication -Name $params.Name `
-ErrorAction SilentlyContinue
if ($null -ne $apps)
{
-Arguments $PSBoundParameters `
-ScriptBlock {
$params = $args[0]
$apps = Get-SPServiceApplication -Name $params.Name `
-ErrorAction SilentlyContinue
if ($null -ne $apps)
{
$app = $apps | Where-Object -FilterScript {
$_.GetType().FullName -eq "Microsoft.Office.Access.Server.MossHost.AccessServerWebServiceApplication"
$_.GetType().FullName -eq "Microsoft.Office.Access.Server.MossHost.AccessServerWebServiceApplication"
}
if ($null -ne $app)
{
Expand All @@ -122,29 +122,29 @@ function Set-TargetResource
return;
}
}
}
}

$accessApp = New-SPAccessServiceApplication -Name $params.Name `
-ApplicationPool $params.ApplicationPool
$accessApp = New-SPAccessServiceApplication -Name $params.Name `
-ApplicationPool $params.ApplicationPool
}
}
if ($Ensure -eq "Absent")
{
Write-Verbose "Removing Access 2010 service application '$Name'"
Invoke-SPDscCommand -Credential $InstallAccount `
-Arguments $PSBoundParameters `
-ScriptBlock {
-Arguments $PSBoundParameters `
-ScriptBlock {
$params = $args[0]

$apps = Get-SPServiceApplication -Name $params.Name `
-ErrorAction SilentlyContinue
-ErrorAction SilentlyContinue
if ($null -eq $apps)
{
return
}

$app = $apps | Where-Object -FilterScript {
$_.GetType().FullName -eq "Microsoft.Office.Access.Server.MossHost.AccessServerWebServiceApplication"
$_.GetType().FullName -eq "Microsoft.Office.Access.Server.MossHost.AccessServerWebServiceApplication"
}

if ($null -ne $app)
Expand All @@ -170,7 +170,7 @@ function Test-TargetResource
$ApplicationPool,

[Parameter()]
[ValidateSet("Present","Absent")]
[ValidateSet("Present", "Absent")]
[System.String]
$Ensure = "Present",

Expand All @@ -187,8 +187,8 @@ function Test-TargetResource
Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)"

return Test-SPDscParameterState -CurrentValues $CurrentValues `
-DesiredValues $PSBoundParameters `
-ValuesToCheck @("Name", "ApplicationPool", "Ensure")
-DesiredValues $PSBoundParameters `
-ValuesToCheck @("Name", "ApplicationPool", "Ensure")
}

Export-ModuleMember -Function *-TargetResource
Loading

0 comments on commit 4a720ae

Please sign in to comment.