Skip to content

Commit 1b0cdab

Browse files
authored
Merge pull request #666 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents 19b963a + f4c5ed0 commit 1b0cdab

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecSetPackageTag.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ function Invoke-ExecSetPackageTag {
3939
GUID = "$GUID"
4040
Package = $PackageValue
4141
SHA = $Template.SHA ?? $null
42+
Source = $Template.Source ?? $null
4243
}
4344

44-
4545
Add-CIPPAzDataTableEntity @Table -Entity $Entity -Force
4646

4747
if ($Remove -eq $true) {

Modules/CIPPCore/Public/New-CIPPTemplateRun.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ function New-CIPPTemplateRun {
5252
$ExistingTemplate = $ExistingTemplates | Where-Object { (![string]::IsNullOrEmpty($_.displayName) -and (Get-SanitizedFilename -filename $_.displayName) -eq (Get-SanitizedFilename -filename $File.name)) -or (![string]::IsNullOrEmpty($_.templateName) -and (Get-SanitizedFilename -filename $_.templateName) -eq (Get-SanitizedFilename -filename $File.name) ) -and ![string]::IsNullOrEmpty($_.SHA) } | Select-Object -First 1
5353

5454
$UpdateNeeded = $false
55-
if ($ExistingTemplate -and $ExistingTemplate.SHA -ne $File.sha) {
55+
if ($ExistingTemplate -and $ExistingTemplate.SHA -ne $File.sha -and $ExistingTemplate.Source -eq $TemplateSettings.templateRepo.value) {
5656
$Name = $ExistingTemplate.displayName ?? $ExistingTemplate.templateName
5757
Write-Information "Existing template $($Name) found, but SHA is different. Updating template."
5858
$UpdateNeeded = $true
5959
"Template $($Name) needs to be updated as the SHA is different"
60-
} elseif ($ExistingTemplate -and $ExistingTemplate.SHA -eq $File.sha) {
60+
} elseif ($ExistingTemplate -and $ExistingTemplate.SHA -eq $File.sha -and $ExistingTemplate.Source -eq $TemplateSettings.templateRepo.value) {
6161
Write-Information "Existing template $($File.name) found, but SHA is the same. No update needed."
6262
"Template $($File.name) found, but SHA is the same. No update needed."
6363
}
@@ -263,7 +263,7 @@ function New-CIPPTemplateRun {
263263
RAWJson = $Template.TemplateJson
264264
Type = $Template.Type
265265
GUID = $ExistingPolicy.GUID
266-
} | ConvertTo-Json
266+
} | ConvertTo-Json -Compress
267267

268268
Add-CIPPAzDataTableEntity @Table -Entity @{
269269
JSON = "$object"
@@ -283,7 +283,7 @@ function New-CIPPTemplateRun {
283283
RAWJson = $Template.TemplateJson
284284
Type = $Template.Type
285285
GUID = $GUID
286-
} | ConvertTo-Json
286+
} | ConvertTo-Json -Compress
287287

288288
Add-CIPPAzDataTableEntity @Table -Entity @{
289289
JSON = "$object"
@@ -317,7 +317,7 @@ function New-CIPPTemplateRun {
317317
RAWJson = $Template.TemplateJson
318318
Type = $Template.Type
319319
GUID = $ExistingPolicy.GUID
320-
} | ConvertTo-Json
320+
} | ConvertTo-Json -Compress
321321

322322
Add-CIPPAzDataTableEntity @Table -Entity @{
323323
JSON = "$object"
@@ -337,7 +337,7 @@ function New-CIPPTemplateRun {
337337
RAWJson = $Template.TemplateJson
338338
Type = $Template.Type
339339
GUID = $GUID
340-
} | ConvertTo-Json
340+
} | ConvertTo-Json -Compress
341341

342342
Add-CIPPAzDataTableEntity @Table -Entity @{
343343
JSON = "$object"

0 commit comments

Comments
 (0)