File tree 1 file changed +22
-28
lines changed
src/features/vars-schema/hooks
1 file changed +22
-28
lines changed Original file line number Diff line number Diff line change @@ -316,24 +316,26 @@ addEnvHooks('device_service_environment_variable', async (args) => {
316
316
] ;
317
317
} ) ;
318
318
319
+ // Normally we don't expect these to return any match, since our clients
320
+ // * POST image env vars before the release & images gets marked as successful
321
+ // * never PATCH them after that point
322
+ // * DELETEs are expected to normally only happen if the release gets DELETED,
323
+ // in which case the should_be_running__release will change and trigger an update of its own.
319
324
addEnvHooks ( 'image_environment_variable' , async ( args ) => {
325
+ // The filter paths here should match the expand path of the state GET.
320
326
if ( args . req . body . release_image != null ) {
321
327
return {
322
- image_install : {
328
+ should_be_running__release : {
323
329
$any : {
324
- $alias : 'ii ' ,
330
+ $alias : 'r ' ,
325
331
$expr : {
326
- installs__image : {
332
+ status : 'success' ,
333
+ release_image : {
327
334
$any : {
328
- $alias : 'i ' ,
335
+ $alias : 'ri ' ,
329
336
$expr : {
330
- i : {
331
- release_image : {
332
- $any : {
333
- $alias : 'ri' ,
334
- $expr : { ri : { id : args . req . body . release_image } } ,
335
- } ,
336
- } ,
337
+ ri : {
338
+ id : args . req . body . release_image ,
337
339
} ,
338
340
} ,
339
341
} ,
@@ -351,28 +353,20 @@ addEnvHooks('image_environment_variable', async (args) => {
351
353
return [
352
354
envVarIds ,
353
355
( envVarIdsChunk ) => ( {
354
- image_install : {
356
+ should_be_running__release : {
355
357
$any : {
356
- $alias : 'ii ' ,
358
+ $alias : 'r ' ,
357
359
$expr : {
358
- installs__image : {
360
+ status : 'success' ,
361
+ release_image : {
359
362
$any : {
360
- $alias : 'i ' ,
363
+ $alias : 'ri ' ,
361
364
$expr : {
362
- i : {
363
- release_image : {
365
+ ri : {
366
+ image_environment_variable : {
364
367
$any : {
365
- $alias : 'ri' ,
366
- $expr : {
367
- ri : {
368
- image_environment_variable : {
369
- $any : {
370
- $alias : 'e' ,
371
- $expr : { e : { id : { $in : envVarIdsChunk } } } ,
372
- } ,
373
- } ,
374
- } ,
375
- } ,
368
+ $alias : 'e' ,
369
+ $expr : { e : { id : { $in : envVarIdsChunk } } } ,
376
370
} ,
377
371
} ,
378
372
} ,
You can’t perform that action at this time.
0 commit comments