Skip to content

Commit

Permalink
Merge pull request #865 from PowerShell/release-2.5
Browse files Browse the repository at this point in the history
Release 2.5
  • Loading branch information
kwirkykat authored Sep 5, 2018
2 parents 2ffec7c + 8518f32 commit 0d3f59e
Show file tree
Hide file tree
Showing 53 changed files with 2,943 additions and 1,053 deletions.
21 changes: 0 additions & 21 deletions .github/ISSUE_TEMPLATE.md

This file was deleted.

7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE/General.md
Original file line number Diff line number Diff line change
@@ -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.
---
<!--
Your feedback and support is greatly appreciated, thanks for contributing!
-->
59 changes: 59 additions & 0 deletions .github/ISSUE_TEMPLATE/Problem_with_resource.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
name: Problem with a resource
about: If you have a problem, bug, or enhancement with a resource in this resource module.
---
<!--
Your feedback and support is greatly appreciated, thanks for contributing!
ISSUE TITLE:
Please prefix the issue title with the resource name, e.g.
'ResourceName: Short description of my issue'
ISSUE DESCRIPTION (this template):
Please provide information regarding your issue under each header below.
Write N/A under any headers that do not apply to your issue, or if the
information is not available.
NOTE! Sensitive information should be obfuscated.
PLEASE KEEP THE HEADERS.
You may remove this comment block, and the other comment blocks,
but please keep the headers.
-->
#### 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
<!--
Please provide as much as possible about the target node, for example
edition, version, build and language.
On OS with WMF 5.1 the following command can help get this information.
Get-ComputerInfo -Property @(
'OsName',
'OsOperatingSystemSKU',
'OSArchitecture',
'WindowsVersion',
'WindowsBuildLabEx',
'OsLanguage',
'OsMuiLanguages')
-->

#### Version of SharePoint that is used (e.g. SharePoint 2016)

#### Version and build of PowerShell the target node is running
<!--
To help with this information, please run this command:
$PSVersionTable
-->

#### Version of the DSC module that was used ('dev' if using current dev branch)
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/Resource_proposal.md
Original file line number Diff line number Diff line change
@@ -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.
---
<!--
Thank you for contributing and making this resource module better!
ISSUE TITLE:
Please prefix the issue title with a proposed resource name,
e.g. 'NewResourceName: New resource proposal'
ISSUE DESCRIPTION (this template):
Please propose the new resource under each header below.
PLEASE KEEP THE HEADERS, but you may remove this comment block.
-->
### Description

### Proposed properties

### Special considerations or limitations
57 changes: 43 additions & 14 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,49 @@
Thanks for submitting a Pull Request to this project.
This template will help you create your pull request.
<!--
Thanks for submitting a Pull Request (PR) to this project.
Your contribution to this project is greatly appreciated!
Please make sure you have read the [Contribution Guidelines](https://github.com/powershell/xSharePoint/wiki/Contributing%20to%20xSharePoint).
Please make sure you have read the [Contribution Guidelines](https://github.com/PowerShell/SharePointDsc/wiki/Contributing%20to%20SharePointDsc).
To aid community reviewers in reviewing and merging your PR, please take the time to run through this checklist:
Please prefix the PR title with the resource name,
e.g. 'ResourceName: My short description'.
If this is a breaking change, then also prefix the PR title
with 'BREAKING CHANGE:',
e.g. 'BREAKING CHANGE: ResourceName: My short description'.
**DELETE THIS LINE AND ABOVE**
You may remove this comment block, and the other comment blocks, but please
keep the headers and the task list.
-->
#### Pull Request (PR) description
<!--
Replace this comment block with a description of your PR.
-->

[Replace this with a description of your pull request]
#### This Pull Request (PR) fixes the following issues
<!--
If this PR does not fix an open issue, replace this comment block with None.
If this PR resolves one or more open issues, replace this comment block with
a list the issues using a GitHub closing keyword, e.g.:
- Fixes #123
- Fixes #124
-->

- [ ] Change details added to Unreleased section of changelog.md?
- [ ] Added/updated documentation and descriptions in .schema.mof files where appropriate?
- [ ] Examples updated for both the single server and small farm templates in the examples folder?
- [ ] New/changed code adheres to [Style Guidelines](https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md)?
- [ ] [Unit and Integration tests](https://github.com/PowerShell/DscResources/blob/master/TestsGuidelines.md) created/updated where possible?
#### Task list
<!--
To aid community reviewers in reviewing and merging your PR, please take
the time to run through the below checklist and make sure your PR has
everything updated as required.
**DELETE THIS LINE AND BELOW**

Your contribution to this project is greatly appreciated.
Change to [x] for each task in the task list that applies to your PR.
For those task that don't apply to you PR, leave those as is.
-->
- [ ] 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 in the resource folder.
- [ ] Resource parameter descriptions added/updated in 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).
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,41 @@
# Change log for SharePointDsc

## 2.5

* SPAppCatalog
* Updated resource to retrieve the Farm account instead of requiring it
to be specifically used
* SPDatabaseAAG
* Updated readme.md to specify that this resource also updates the database
connection string
* SPDiagnosticsProvider
* Fixed issue where enabling providers did not work
* SPFarm
* Added ability to check and update CentralAdministrationPort
* SPLogLevel
* Added High as TraceLevel, which was not included yet
* SPRemoteFarmTrust
* Updated readme.md file to add a link that was lost during earlier updates
* SPSearchServiceApp
* Updated Set method to check if service application pool exists. Resource
will throw an error if it does not exist
* SPSearchTopology
* Fixed issue where Get method threw an error when the specified service
application didn't exist yet
* Fixed issue where the resource would fail is the FQDN was specified
* SPShellAdmins
* Added ExcludeDatabases parameter for AllDatabases
* SPSite
* Added ability to check and update QuotaTemplate, OwnerAlias and SecondaryOwnerAlias
* SPSiteUrl
* New resource to manage site collection urls for host named site collections
* SPTrustedIdentityTokenIssuerProviderRealm
* Fixed issue where Get method threw an error when the realm didn't exist yet
* SPUserProfileServiceApp
* Fix for issue where an update conflict error was thrown when new service
application was created
* Added SiteNamingConflictResolution parameter to the resource

## 2.4

* SPCacheAccounts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ function Get-TargetResource
[OutputType([System.Collections.Hashtable])]
param
(
[Parameter(Mandatory = $true)]
[System.String]
[Parameter(Mandatory = $true)]
[System.String]
$SiteUrl,

[Parameter()]
[System.Management.Automation.PSCredential]
[Parameter()]
[System.Management.Automation.PSCredential]
$InstallAccount
)

Expand All @@ -25,20 +25,20 @@ function Get-TargetResource
SiteUrl = $null
InstallAccount = $params.InstallAccount
}
if ($null -eq $site)
if ($null -eq $site)
{
return $nullreturn
}
$wa = $site.WebApplication
$feature = $wa.Features.Item([Guid]::Parse("f8bea737-255e-4758-ab82-e34bb46f5828"))
if($null -eq $feature)
if ($null -eq $feature)
{
return $nullreturn
}
if ($site.ID -ne $feature.Properties["__AppCatSiteId"].Value)
if ($site.ID -ne $feature.Properties["__AppCatSiteId"].Value)
{
return $nullreturn
}
}
return @{
SiteUrl = $site.Url
InstallAccount = $params.InstallAccount
Expand All @@ -53,30 +53,99 @@ function Set-TargetResource
param
(
[Parameter(Mandatory = $true)]
[System.String]
[System.String]
$SiteUrl,

[Parameter()]
[System.Management.Automation.PSCredential]
[Parameter()]
[System.Management.Automation.PSCredential]
$InstallAccount
)

Write-Verbose -Message "Setting app catalog status of $SiteUrl"

Invoke-SPDSCCommand -Credential $InstallAccount `
Write-Verbose -Message "Retrieving farm account"
$farmAccount = Invoke-SPDSCCommand -Credential $InstallAccount `
-Arguments $PSBoundParameters `
-ScriptBlock {
return Get-SPDscFarmAccount
}

Write-Verbose -Message "Check if InstallAccount or PsDscRunAsCredential is the farm account"
if ($null -ne $farmAccount)
{
if ($PSBoundParameters.ContainsKey("InstallAccount") -eq $true)
{
# InstallAccount used
if ($InstallAccount.UserName -eq $farmAccount.UserName)
{
throw ("Specified InstallAccount ($($InstallAccount.UserName)) is the Farm " + `
"Account. Make sure the specified InstallAccount isn't the Farm Account " + `
"and try again")
}
}
else
{
# PSDSCRunAsCredential or System
if (-not $Env:USERNAME.Contains("$"))
{
# PSDSCRunAsCredential used
$localaccount = "$($Env:USERDOMAIN)\$($Env:USERNAME)"
if ($localaccount -eq $farmAccount.UserName)
{
throw ("Specified PSDSCRunAsCredential ($localaccount) is the Farm " + `
"Account. Make sure the specified PSDSCRunAsCredential isn't the " + `
"Farm Account and try again")
}
}
}
}
else
{
throw ("Unable to retrieve the Farm Account. Check if the farm exists.")
}

# Add the FarmAccount to the local Administrators group, if it's not already there
$isLocalAdmin = Test-SPDSCUserIsLocalAdmin -UserName $farmAccount.UserName

if (!$isLocalAdmin)
{
Write-Verbose -Message "Adding farm account to Local Administrators group"
Add-SPDSCUserToLocalAdmin -UserName $farmAccount.UserName

# Cycle the Timer Service and flush Kerberos tickets
# so that it picks up the local Admin token
Restart-Service -Name "SPTimerV4"

Clear-SPDscKerberosToken -Account $farmAccount.UserName
}

Invoke-SPDSCCommand -Credential $farmAccount `
-Arguments $PSBoundParameters `
-ScriptBlock {
$params = $args[0]
try
try
{
Update-SPAppCatalogConfiguration -Site $params.SiteUrl -Confirm:$false
Update-SPAppCatalogConfiguration -Site $params.SiteUrl -Confirm:$false
}
catch [System.UnauthorizedAccessException]
catch [System.UnauthorizedAccessException]
{
throw ("This resource must be run as the farm account (not a setup account). " + `
"Please ensure either the PsDscRunAsCredential or InstallAccount " + `
"credentials are set to the farm account and run this resource again")
}
} | Out-Null

# Remove the FarmAccount from the local Administrators group, if it was added above
if (!$isLocalAdmin)
{
Write-Verbose -Message "Removing farm account from Local Administrators group"
Remove-SPDSCUserToLocalAdmin -UserName $farmAccount.UserName

# Cycle the Timer Service and flush Kerberos tickets
# so that it picks up the local Admin token
Restart-Service -Name "SPTimerV4"

Clear-SPDscKerberosToken -Account $farmAccount.UserName
}
}

Expand All @@ -86,20 +155,20 @@ function Test-TargetResource
[OutputType([System.Boolean])]
param
(
[Parameter(Mandatory = $true)]
[System.String]
[Parameter(Mandatory = $true)]
[System.String]
$SiteUrl,

[Parameter()]
[System.Management.Automation.PSCredential]
[Parameter()]
[System.Management.Automation.PSCredential]
$InstallAccount
)

Write-Verbose -Message "Testing app catalog status of $SiteUrl"

return Test-SPDscParameterState -CurrentValues (Get-TargetResource @PSBoundParameters) `
-DesiredValues $PSBoundParameters `
-ValuesToCheck @("SiteUrl")
-ValuesToCheck @("SiteUrl")
}

Export-ModuleMember -Function *-TargetResource
Loading

0 comments on commit 0d3f59e

Please sign in to comment.