Skip to content

Commit

Permalink
Merge pull request KelvinTegelaar#520 from KelvinTegelaar/dev
Browse files Browse the repository at this point in the history
Dev to release
  • Loading branch information
KelvinTegelaar authored Dec 11, 2023
2 parents 69fa007 + df42379 commit 499ee3a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Function Invoke-AddStandardsDeploy {

try {
$Tenants = ($Request.body | Select-Object Select_*).psobject.properties.value
$Settings = ($request.body | Select-Object -Property *, 'v2' -ExcludeProperty Select_*, None )
$Settings = ($request.body | Select-Object -Property *, v2* -ExcludeProperty Select_*, None )
$Settings.v2 = $true
foreach ($Tenant in $tenants) {

Expand All @@ -37,8 +37,7 @@ Function Invoke-AddStandardsDeploy {
}
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -message 'Successfully added standards deployment' -Sev 'Info'
$body = [pscustomobject]@{'Results' = 'Successfully added standards deployment' }
}
catch {
} catch {
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -message "Standards API failed. Error:$($_.Exception.Message)" -Sev 'Error'
$body = [pscustomobject]@{'Results' = "Failed to add standard: $($_.Exception.Message)" }
}
Expand Down
13 changes: 9 additions & 4 deletions Modules/CIPPCore/Public/Invoke-CIPPStandardsRun.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function Invoke-CIPPStandardsRun {
$Tenants = (Get-CIPPAzDataTableEntity @Table -Filter $Filter).JSON | ConvertFrom-Json

#Migrate from old standards to new standards.
$Tenants | Where-Object -Property 'v2' -NE $true | ForEach-Object {
$Tenants | Where-Object -Property 'v2.1' -NE $true | ForEach-Object {
$OldStd = $_
$OldStd.standards.psobject.properties.name | ForEach-Object {
if ($_ -eq 'MailContacts') {
Expand All @@ -28,10 +28,15 @@ function Invoke-CIPPStandardsRun {
remediate = $true
}
} else {
$OldStd.Standards.$_ | Add-Member -NotePropertyName 'remediate' -NotePropertyValue $true
if ($OldStd.Standards.$_ -eq $true) {
$OldStd.Standards.$_ = @{ remediate = $true }
} else {
$OldStd.Standards.$_ | Add-Member -NotePropertyName 'remediate' -NotePropertyValue $true -Force
}

}
}
$OldStd | Add-Member -NotePropertyName 'v2' -NotePropertyValue $true -PassThru -Force
$OldStd | Add-Member -NotePropertyName 'v2.1' -NotePropertyValue $true -PassThru -Force
$Entity = @{
PartitionKey = 'standards'
RowKey = "$($OldStd.Tenant)"
Expand Down Expand Up @@ -73,7 +78,7 @@ function Invoke-CIPPStandardsRun {

#For each item in our object, run the queue.

foreach ($task in $object | Where-Object -Property Standard -NE 'v2') {
foreach ($task in $object | Where-Object -Property Standard -NotLike 'v2*') {
$QueueItem = [pscustomobject]@{
Tenant = $task.Tenant
Standard = $task.Standard
Expand Down
2 changes: 1 addition & 1 deletion version_latest.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.8.0
4.8.1

0 comments on commit 499ee3a

Please sign in to comment.