Skip to content

Commit

Permalink
Merge pull request #649 from mhendric/FixPublishModulesAndMofsToPullS…
Browse files Browse the repository at this point in the history
…erver

PublishModulesAndMofsToPullServer: Fixes file read bug in Publish-MOFToPullServer
  • Loading branch information
PlagueHO authored Nov 30, 2019
2 parents 33217a0 + e1576fe commit 5648aea
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 26 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

- PublishModulesAndMofsToPullServer.psm1:
- Fixes issue in Publish-MOFToPullServer that incorrectly tries to create a
new MOF file instead of reading the existing one.
[issue #575](https://github.com/PowerShell/xPSDesiredStateConfiguration/issues/575)
- Fix minor style issues with missing spaces between `param` statements and '('.
- MSFT_xDSCWebService:
- Removal of commented out code.
Expand Down
36 changes: 12 additions & 24 deletions DSCPullServerSetup/PublishModulesAndMofsToPullServer.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ function Publish-MOFToPullServer
[Parameter(Mandatory = $true,
ValueFromPipelineByPropertyName = $true,
Position = 0)]
[ValidateScript({Test-Path -Path $_ -PathType Leaf})]
[System.String]
$FullName,

Expand All @@ -438,35 +439,22 @@ function Publish-MOFToPullServer
{
if (-not($OutputFolderPath) -or -not (Test-Path -Path $OutputFolderPath))
{
if (-not(Test-Path $PullServerWebConfig))
{
throw "Web.Config of the pullserver does not exist on the default path $PullServerWebConfig. Please provide the location of your pullserver web configuration using the parameter -PullServerWebConfig or an alternate path where you want to publish the pullserver MOFs to. This Path should exist."
}
else
{
<#
Web.Config of Pull Server found so figure out the module path of the pullserver.
Use this value as output folder path.
#>
$webConfigXml = [System.Xml.XmlDocument] (Get-Content -Path $PullServerWebConfig)
$configXElement = $webConfigXml.SelectNodes("//appSettings/add[@key = 'ConfigurationPath']")
$OutputFolderPath = $configXElement.Value
}
<#
Web.Config of Pull Server found so figure out the module path of the pullserver.
Use this value as output folder path.
#>
$webConfigXml = [System.Xml.XmlDocument] (Get-Content -Path $PullServerWebConfig)
$configXElement = $webConfigXml.SelectNodes("//appSettings/add[@key = 'ConfigurationPath']")
$OutputFolderPath = $configXElement.Value
}
}
Process
{
$fileInfo = New-Item -Path $FullName -ItemType File
if ($fileInfo.Extension -eq '.mof')
$fileItem = Get-Item -Path $FullName

if ($fileItem.Extension -eq '.mof')
{
if (Test-Path -Path $FullName)
{
Copy-Item -Path $FullName -Destination $OutputFolderPath -Force
}
else
{
throw "File not found at $FullName"
}
Copy-Item -Path $FullName -Destination $OutputFolderPath -Force
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions DSCResources/MSFT_xMsiPackage/MSFT_xMsiPackage.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,8 @@ function Set-TargetResource
-Namespace 'root\microsoft\windows\servermanager' `
-Class 'MSFT_ServerManagerTasks' `
-Arguments @{
BatchSize = 256
} `
BatchSize = 256
} `
-ErrorAction 'Ignore'

$registryData = Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Name 'PendingFileRenameOperations' -ErrorAction 'Ignore'
Expand Down

0 comments on commit 5648aea

Please sign in to comment.