Skip to content

Commit

Permalink
Merge pull request #1113 from JohnDuprey/dev
Browse files Browse the repository at this point in the history
Fix CIPPTimer
  • Loading branch information
JohnDuprey authored Sep 6, 2024
2 parents b9758f8 + ac66b84 commit 5f35efe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Modules/CIPPCore/Public/Get-CIPPAuthentication.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ function Get-CIPPAuthentication {
}
} else {
Connect-AzAccount -Identity

$keyvaultname = $ENV:WEBSITE_DEPLOYMENT_ID -replace '-proc$', ''
$Variables | ForEach-Object {
Set-Item -Path ENV:$_ -Value (Get-AzKeyVaultSecret -VaultName $ENV:WEBSITE_DEPLOYMENT_ID -Name $_ -AsPlainText -ErrorAction Stop) -Force
Set-Item -Path ENV:$_ -Value (Get-AzKeyVaultSecret -VaultName $keyvaultname -Name $_ -AsPlainText -ErrorAction Stop) -Force
}
}
$ENV:SetFromProfile = $true
Expand Down
5 changes: 3 additions & 2 deletions Modules/CIPPCore/Public/Get-CIPPTimerFunctions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ function Get-CIPPTimerFunctions {
$CIPPRoot = (Get-Item $CIPPCoreModuleRoot).Parent.Parent
$Orchestrators = Get-Content -Path $CIPPRoot\CIPPTimers.json | ConvertFrom-Json | Where-Object { $_.RunOnProcessor -eq $RunOnProcessor }
$Table = Get-CIPPTable -TableName 'CIPPTimers'
$OrchestratorStatus = Get-CIPPAzDataTableEntity @Table -Filter "RunOnProcessor eq $RunOnProcessor"
$RunOnProcessorTxt = if ($RunOnProcessor) { 'true' } else { 'false' }
$OrchestratorStatus = Get-CIPPAzDataTableEntity @Table -Filter "RunOnProcessor eq $RunOnProcessorTxt"
foreach ($Orchestrator in $Orchestrators) {
$Status = $OrchestratorStatus | Where-Object { $_.RowKey -eq $Orchestrator.Command }
if ($Status.Cron) {
Expand All @@ -50,7 +51,7 @@ function Get-CIPPTimerFunctions {
$NextOccurrence = [datetime]$Cron.GetNextOccurrence($Now)
} else {
$NextOccurrences = $Cron.GetNextOccurrences($Now.AddMinutes(-15), $Now.AddMinutes(15))
if ($Status.LastOccurrence -eq 'Never') {
if (!$Status -or $Status.LastOccurrence -eq 'Never') {
$NextOccurrence = $NextOccurrences | Where-Object { $_ -le (Get-Date) } | Select-Object -First 1
} else {
$NextOccurrence = $NextOccurrences | Where-Object { $_ -gt $Status.LastOccurrence.DateTime.ToLocalTime() -and $_ -le (Get-Date) } | Select-Object -First 1
Expand Down

0 comments on commit 5f35efe

Please sign in to comment.