File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -178,8 +178,15 @@ async function dumpLogs(): Promise<void> {
178178 console . log ( 'not dumping logs because' , logDir , 'does not exist' ) ;
179179 return ;
180180 }
181- const podNames = await kubectl . getPodNames ( 'snyk-monitor' ) ;
182- const logs = await kubectl . getPodLogs ( podNames [ 0 ] , 'snyk-monitor' ) ;
181+
182+ const podNames = await kubectl . getPodNames ( 'snyk-monitor' ) . catch ( ( ) => [ ] ) ;
183+ const snykMonitorPod = podNames . find ( ( name ) => name . startsWith ( 'snyk-monitor' ) ) ;
184+ if ( snykMonitorPod === undefined ) {
185+ console . log ( 'not dumping logs because snyk-monitor pod does not exist' ) ;
186+ return ;
187+ }
188+
189+ const logs = await kubectl . getPodLogs ( snykMonitorPod , 'snyk-monitor' ) ;
183190 const logPath = `${ logDir } /kubernetes-monitor.log` ;
184191 console . log ( 'dumping logs to' , logPath ) ;
185192 fs . writeFileSync ( logPath , logs ) ;
You can’t perform that action at this time.
0 commit comments