@@ -214,51 +214,54 @@ func (o OpenStackLogCollector) CollectMachineLog(ctx context.Context, management
214
214
return fmt .Errorf ("error writing server JSON %s: %s" , serverJSON , err )
215
215
}
216
216
217
- srvUser := o .E2EContext .E2EConfig .GetVariable (SSHUserMachine )
218
- executeCommands (
219
- ctx ,
220
- o .E2EContext .Settings .ArtifactFolder ,
221
- o .E2EContext .Settings .Debug ,
222
- outputPath ,
223
- ip ,
224
- openStackCluster .Status .Bastion .FloatingIP ,
225
- srvUser ,
226
- []command {
227
- // don't do this for now, it just takes to long
228
- // {
229
- // title: "systemd",
230
- // cmd: "journalctl --no-pager --output=short-precise | grep -v 'audit:\\|audit\\['",
231
- // },
232
- {
233
- title : "kern" ,
234
- cmd : "journalctl --no-pager --output=short-precise -k" ,
217
+ // If the machine has a bastion, collect logs from there.
218
+ if openStackCluster .Status .Bastion != nil {
219
+ srvUser := o .E2EContext .E2EConfig .GetVariable (SSHUserMachine )
220
+ executeCommands (
221
+ ctx ,
222
+ o .E2EContext .Settings .ArtifactFolder ,
223
+ o .E2EContext .Settings .Debug ,
224
+ outputPath ,
225
+ ip ,
226
+ openStackCluster .Status .Bastion .FloatingIP ,
227
+ srvUser ,
228
+ []command {
229
+ // don't do this for now, it just takes to long
230
+ // {
231
+ // title: "systemd",
232
+ // cmd: "journalctl --no-pager --output=short-precise | grep -v 'audit:\\|audit\\['",
233
+ // },
234
+ {
235
+ title : "kern" ,
236
+ cmd : "journalctl --no-pager --output=short-precise -k" ,
237
+ },
238
+ {
239
+ title : "containerd-info" ,
240
+ cmd : "crictl --runtime-endpoint unix:///run/containerd/containerd.sock info" ,
241
+ },
242
+ {
243
+ title : "containerd-containers" ,
244
+ cmd : "crictl --runtime-endpoint unix:///run/containerd/containerd.sock ps" ,
245
+ },
246
+ {
247
+ title : "containerd-pods" ,
248
+ cmd : "crictl --runtime-endpoint unix:///run/containerd/containerd.sock pods" ,
249
+ },
250
+ {
251
+ title : "cloud-final" ,
252
+ cmd : "journalctl --no-pager -u cloud-final" ,
253
+ },
254
+ {
255
+ title : "kubelet" ,
256
+ cmd : "journalctl --no-pager -u kubelet.service" ,
257
+ },
258
+ {
259
+ title : "containerd" ,
260
+ cmd : "journalctl --no-pager -u containerd.service" ,
261
+ },
235
262
},
236
- {
237
- title : "containerd-info" ,
238
- cmd : "crictl --runtime-endpoint unix:///run/containerd/containerd.sock info" ,
239
- },
240
- {
241
- title : "containerd-containers" ,
242
- cmd : "crictl --runtime-endpoint unix:///run/containerd/containerd.sock ps" ,
243
- },
244
- {
245
- title : "containerd-pods" ,
246
- cmd : "crictl --runtime-endpoint unix:///run/containerd/containerd.sock pods" ,
247
- },
248
- {
249
- title : "cloud-final" ,
250
- cmd : "journalctl --no-pager -u cloud-final" ,
251
- },
252
- {
253
- title : "kubelet" ,
254
- cmd : "journalctl --no-pager -u kubelet.service" ,
255
- },
256
- {
257
- title : "containerd" ,
258
- cmd : "journalctl --no-pager -u containerd.service" ,
259
- },
260
- },
261
- )
263
+ )
264
+ }
262
265
return nil
263
266
}
264
267
0 commit comments