Skip to content

Commit 94dd457

Browse files
authored
Merge pull request #37 from sirinek/bugfix/checkfile
create a blank patching.json file if it does not exist
2 parents a8ba801 + c948da3 commit 94dd457

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44

55
## Development
66

7+
* Ensure the patching.json file exists by creating a blank file if it was previously missing.
8+
9+
Contributed by Bill Sirinek (@sirinek)
10+
711
* use 'name' instead of 'host' to better represent targets in inventory
812

913
Contributed by Vadym Chepkov (@vchepkov)

tasks/update_history_windows.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ if ($result_file -eq '') {
1616
$result_file = 'C:\ProgramData\patching\log\patching.json'
1717
}
1818

19+
# if the result file does not exist, create it
20+
if (-not (Test-Path $result_file)) {
21+
New-Item -ItemType "file" -Path (Split-Path -Path $result_file) -Name (Split-Path -Path $result_file -Leaf) | Out-Null
22+
}
23+
1924
$pattern_matches = Select-String -Path $result_file -Pattern "^{$"
2025
if ($pattern_matches) {
2126
# get the LAST matching line number of { , the start of a JSON document

0 commit comments

Comments
 (0)