@@ -129,41 +129,6 @@ pub struct Args {
129
129
pub trait ContainerDumper {
130
130
fn dump_container_resources ( & self ) -> impl std:: future:: Future < Output = ( ) > ;
131
131
}
132
- pub enum ContainerServiceDumper < ' n > {
133
- K8s ( K8sDumper < ' n > ) ,
134
- Docker ( DockerDumper ) ,
135
- }
136
-
137
- impl < ' n > ContainerServiceDumper < ' n > {
138
- fn new_k8s_dumper (
139
- context : & ' n Context ,
140
- client : KubernetesClient ,
141
- k8s_namespaces : Vec < String > ,
142
- k8s_context : Option < String > ,
143
- k8s_dump_secret_values : bool ,
144
- ) -> Self {
145
- Self :: K8s ( K8sDumper :: new (
146
- context,
147
- client,
148
- k8s_namespaces,
149
- k8s_context,
150
- k8s_dump_secret_values,
151
- ) )
152
- }
153
-
154
- fn new_docker_dumper ( context : & ' n Context , docker_container_id : String ) -> Self {
155
- Self :: Docker ( DockerDumper :: new ( context, docker_container_id) )
156
- }
157
- }
158
-
159
- impl < ' n > ContainerDumper for ContainerServiceDumper < ' n > {
160
- async fn dump_container_resources ( & self ) {
161
- match self {
162
- ContainerServiceDumper :: K8s ( dumper) => dumper. dump_container_resources ( ) . await ,
163
- ContainerServiceDumper :: Docker ( dumper) => dumper. dump_container_resources ( ) . await ,
164
- }
165
- }
166
- }
167
132
#[ derive( Clone ) ]
168
133
struct SelfManagedContext {
169
134
dump_k8s : bool ,
@@ -316,7 +281,7 @@ async fn initialize_context(
316
281
async fn run ( context : Context ) -> Result < ( ) , anyhow:: Error > {
317
282
// Depending on if the user is debugging either a k8s environments or docker environment,
318
283
// dump the respective system's resources
319
- let container_system_dumper = match & context. debug_mode_context {
284
+ match & context. debug_mode_context {
320
285
DebugModeContext :: SelfManaged ( SelfManagedContext {
321
286
k8s_client,
322
287
dump_k8s,
@@ -326,34 +291,26 @@ async fn run(context: Context) -> Result<(), anyhow::Error> {
326
291
..
327
292
} ) => {
328
293
if * dump_k8s {
329
- Some ( ContainerServiceDumper :: new_k8s_dumper (
294
+ let dumper = K8sDumper :: new (
330
295
& context,
331
296
k8s_client. clone ( ) ,
332
297
k8s_namespaces. clone ( ) ,
333
298
k8s_context. clone ( ) ,
334
299
* k8s_dump_secret_values,
335
- ) )
336
- } else {
337
- None
300
+ ) ;
301
+ dumper. dump_container_resources ( ) . await ;
338
302
}
339
303
}
340
304
DebugModeContext :: Emulator ( EmulatorContext {
341
305
dump_docker,
342
306
docker_container_id,
343
307
} ) => {
344
308
if * dump_docker {
345
- Some ( ContainerServiceDumper :: new_docker_dumper (
346
- & context,
347
- docker_container_id. clone ( ) ,
348
- ) )
349
- } else {
350
- None
351
- }
352
- }
353
- } ;
354
- if let Some ( dumper) = container_system_dumper {
309
+ let dumper = DockerDumper :: new ( & context, docker_container_id. clone ( ) ) ;
355
310
dumper. dump_container_resources ( ) . await ;
356
311
}
312
+ }
313
+ } ;
357
314
358
315
if context. dump_system_catalog {
359
316
// Dump the system catalog.
0 commit comments