-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
bugThe issue is a bug.The issue is a bug.help wantedThe issue is up for grabs for anyone in the community.The issue is up for grabs for anyone in the community.
Description
Details of the scenario you tried and the problem that is occurring
When using the ReplaceText DSC resource in order to Append Text to a blank/empty text file, the resource throws an error "Exception calling "Matches" with "2" argument(s): "Value cannot be null. Parameter name: input"
Verbose logs showing the problem
Suggested solution to the issue
Enable the resource to handle blank/empty file scenarios. The issue occurs due to $fileContent having a null value, which is expected when the file is blank.
The DSC configuration that is used to reproduce the issue (as detailed as possible)
configuration BlankFileScenario
{
Import-DscResource -ModuleName FileContentDsc
node localhost
{
ReplaceText "BlankEmpty File"
{
Path = 'C:\Dev\blankFile.txt' #blank file -> Get-Content should be true when compared to $null
Search = 'search'
Type = 'Text'
Text = 'replacement'
AllowAppend = $true
}
}
}The operating system the target node is running
Windows Server 2012 R2
Version and build of PowerShell the target node is running
5.1.14409.1018
Version of the DSC module that was used ('dev' if using current dev branch)
1.1.0.108
Metadata
Metadata
Assignees
Labels
bugThe issue is a bug.The issue is a bug.help wantedThe issue is up for grabs for anyone in the community.The issue is up for grabs for anyone in the community.
