File tree Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Original file line number Diff line number Diff line change 16
16
from rich .prompt import Confirm , Prompt
17
17
from rich .table import Table
18
18
19
- from .constants import COMMANDER_CHART , LOGGING_NAMESPACE
19
+ from .constants import (
20
+ BITCOINCORE_CONTAINER ,
21
+ COMMANDER_CHART ,
22
+ COMMANDER_CONTAINER ,
23
+ LOGGING_NAMESPACE ,
24
+ )
20
25
from .k8s import (
21
26
delete_pod ,
22
27
get_default_namespace ,
@@ -331,10 +336,21 @@ def _logs(pod_name: str, follow: bool):
331
336
332
337
try :
333
338
pod = get_pod (pod_name )
334
- container_names = [container .name for container in pod .spec .containers ]
335
- container_name = container_names [0 ]
339
+ eligible_container_names = [BITCOINCORE_CONTAINER , COMMANDER_CONTAINER ]
340
+ available_container_names = [container .name for container in pod .spec .containers ]
341
+ container_name = next (
342
+ (
343
+ container_name
344
+ for container_name in available_container_names
345
+ if container_name in eligible_container_names
346
+ ),
347
+ None ,
348
+ )
349
+ if not container_name :
350
+ print ("Could not determine primary container." )
351
+ return
336
352
except Exception as e :
337
- print (f"Could not determine primary container: { e } " )
353
+ print (f"Error getting pods. Could not determine primary container: { e } " )
338
354
return
339
355
340
356
try :
You can’t perform that action at this time.
0 commit comments