File tree Expand file tree Collapse file tree 3 files changed +13
-6
lines changed
src/WebJobs.Script.WebHost Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -50,9 +50,15 @@ public async Task<IActionResult> Assign([FromBody] EncryptedHostAssignmentContex
50
50
[ Authorize ( Policy = PolicyNames . AdminAuthLevel ) ]
51
51
public async Task < IActionResult > Assign2 ( [ FromBody ] FunctionsWorkerContainerAssignmentContext workerAssignmentContext )
52
52
{
53
+ if ( workerAssignmentContext ? . AssignmentContext == null || workerAssignmentContext . AssignmentContext == null )
54
+ {
55
+ return BadRequest ( "Assignment context is missing." ) ;
56
+ }
57
+
53
58
_logger . LogDebug ( $ "Starting container assignment for host : { Request ? . Host } ") ;
59
+ var assignmentContext = _startupContextProvider . SetContext ( workerAssignmentContext . AssignmentContext ) ;
54
60
55
- return await AssignInternal ( workerAssignmentContext . AssignmentContext ) ;
61
+ return await AssignInternal ( assignmentContext ) ;
56
62
}
57
63
58
64
[ HttpGet ]
@@ -73,10 +79,6 @@ public IActionResult GetHttpHealthStatus()
73
79
74
80
private async Task < IActionResult > AssignInternal ( HostAssignmentContext assignmentContext )
75
81
{
76
- if ( assignmentContext == null )
77
- {
78
- _logger . LogDebug ( $ "Assignment context is null") ;
79
- }
80
82
// before starting the assignment we want to perform as much
81
83
// up front validation on the context as possible
82
84
string error = await _instanceManager . ValidateContext ( assignmentContext ) ;
Original file line number Diff line number Diff line change @@ -9,6 +9,6 @@ namespace Microsoft.Azure.WebJobs.Script.WebHost.Models
9
9
public class FunctionsWorkerContainerAssignmentContext
10
10
{
11
11
[ JsonProperty ( "assignmentContext" ) ]
12
- public HostAssignmentContext AssignmentContext { get ; private set ; }
12
+ public HostAssignmentContext ? AssignmentContext { get ; private set ; }
13
13
}
14
14
}
Original file line number Diff line number Diff line change @@ -142,6 +142,11 @@ public virtual HostAssignmentContext SetContext(EncryptedHostAssignmentContext e
142
142
string decryptedContext = EncryptionHelper . Decrypt ( encryptedContext . EncryptedContext , environment : _environment ) ;
143
143
var hostAssignmentContext = JsonConvert . DeserializeObject < HostAssignmentContext > ( decryptedContext ) ;
144
144
145
+ return SetContext ( hostAssignmentContext ) ;
146
+ }
147
+
148
+ public virtual HostAssignmentContext SetContext ( HostAssignmentContext hostAssignmentContext )
149
+ {
145
150
// Don't update StartupContext for warmup requests
146
151
if ( ! hostAssignmentContext . IsWarmupRequest )
147
152
{
You can’t perform that action at this time.
0 commit comments