File tree 2 files changed +14
-8
lines changed
2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ const shutdown = async (opts) => {
28
28
noRetry,
29
29
reason,
30
30
destroyDelay,
31
- destroyDelayed
31
+ single
32
32
} = opts ;
33
33
const tfPath = workdir ;
34
34
@@ -41,7 +41,13 @@ const shutdown = async (opts) => {
41
41
RUNNER && RUNNER . kill ( 'SIGINT' ) ;
42
42
winston . info ( '\tSuccess' ) ;
43
43
} catch ( err ) {
44
- winston . error ( `\tFailed: ${ err . message } ` ) ;
44
+ if ( single ) {
45
+ winston . warn (
46
+ `\tFailed: Runner in --single mode, might have cleared itself.`
47
+ ) ;
48
+ } else {
49
+ winston . error ( `\tFailed: ${ err . message } ` ) ;
50
+ }
45
51
}
46
52
} ;
47
53
@@ -69,10 +75,8 @@ const shutdown = async (opts) => {
69
75
const destroyTerraform = async ( ) => {
70
76
if ( ! tfResource ) return ;
71
77
72
- if ( destroyDelayed ) {
73
- winston . info ( `Waiting ${ destroyDelay } seconds to destroy` ) ;
74
- await sleep ( destroyDelay ) ;
75
- }
78
+ winston . info ( `Waiting ${ destroyDelay } seconds to destroy` ) ;
79
+ await sleep ( destroyDelay ) ;
76
80
77
81
try {
78
82
winston . debug ( await tf . destroy ( { dir : tfPath } ) ) ;
@@ -424,7 +428,7 @@ exports.handler = async (opts) => {
424
428
try {
425
429
await run ( opts ) ;
426
430
} catch ( error ) {
427
- await shutdown ( { ...opts , error, destroyDelayed : true } ) ;
431
+ await shutdown ( { ...opts , error } ) ;
428
432
}
429
433
} ;
430
434
Original file line number Diff line number Diff line change @@ -339,7 +339,9 @@ class CML {
339
339
}
340
340
341
341
async unregisterRunner ( opts = { } ) {
342
- const { id : runnerId } = await this . runnerByName ( opts ) ;
342
+ const { id : runnerId } = ( await this . runnerByName ( opts ) ) || { } ;
343
+ if ( ! runnerId ) throw new Error ( `Runner with id ${ runnerId } not found` ) ;
344
+
343
345
return await getDriver ( this ) . unregisterRunner ( { runnerId, ...opts } ) ;
344
346
}
345
347
You can’t perform that action at this time.
0 commit comments