File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -21,13 +21,43 @@ Function Invoke-ExecOffloadFunctions {
21
21
22
22
if ($Request.Query.Action -eq ' ListCurrent' ) {
23
23
$CurrentState = Get-CIPPAzDataTableEntity @Table - Filter " PartitionKey eq 'OffloadFunctions' and RowKey eq 'OffloadFunctions'"
24
+ $VersionTable = Get-CippTable - tablename ' Version'
25
+ $Version = Get-CIPPAzDataTableEntity @VersionTable - Filter " RowKey ne 'Version'"
26
+ $MainVersion = $Version | Where-Object { $_.RowKey -eq $env: WEBSITE_SITE_NAME }
27
+ $OffloadVersions = $Version | Where-Object { $_.RowKey -match ' -' }
28
+
29
+ $Alerts = [System.Collections.Generic.List [string ]]::new()
30
+
31
+ $CanEnable = $false
32
+ if (! $OffloadVersions.Version ) {
33
+ $Alerts.Add (' No offloaded function apps have been registered. If you'' ve just deployed one, this can take up to 15 minutes.' )
34
+ } else {
35
+ $CanEnable = $true
36
+ }
37
+
38
+ foreach ($Offload in $OffloadVersions ) {
39
+ $FunctionName = $Offload.RowKey
40
+ if ($OffloadVersion -ne $MainVersion.Version ) {
41
+ $
42
+ $Alerts.Add (" The version of $FunctionName ($ ( $Offload.Version ) ) does not match the current version of $ ( $MainVersion.Version ) ." )
43
+ }
44
+ }
45
+
46
+ $VersionTable = $Version | Select-Object @ {n = ' Name' ; e = { $_.RowKey } }, @ {n = ' Version' ; e = { $_.Version } }
47
+
24
48
$CurrentState = if (! $CurrentState ) {
25
49
[PSCustomObject ]@ {
26
50
OffloadFunctions = $false
51
+ Version = @ ($VersionTable )
52
+ Alerts = $Alerts
53
+ CanEnable = $CanEnable
27
54
}
28
55
} else {
29
56
[PSCustomObject ]@ {
30
57
OffloadFunctions = $CurrentState.state
58
+ Version = @ ($VersionTable )
59
+ Alerts = $Alerts
60
+ CanEnable = $CanEnable
31
61
}
32
62
}
33
63
Push-OutputBinding - Name Response - Value ([HttpResponseContext ]@ {
You can’t perform that action at this time.
0 commit comments