@@ -328,17 +328,16 @@ func NewFactory(clientConfig kclientcmd.ClientConfig) *Factory {
328
328
}
329
329
kLogsForObjectFunc := w .Factory .LogsForObject
330
330
w .LogsForObject = func (object , options runtime.Object ) (* restclient.Request , error ) {
331
- oc , _ , err := w .Clients ()
332
- if err != nil {
333
- return nil , err
334
- }
335
-
336
331
switch t := object .(type ) {
337
332
case * deployapi.DeploymentConfig :
338
333
dopts , ok := options .(* deployapi.DeploymentLogOptions )
339
334
if ! ok {
340
335
return nil , errors .New ("provided options object is not a DeploymentLogOptions" )
341
336
}
337
+ oc , _ , err := w .Clients ()
338
+ if err != nil {
339
+ return nil , err
340
+ }
342
341
return oc .DeploymentLogs (t .Namespace ).Get (t .Name , * dopts ), nil
343
342
case * buildapi.Build :
344
343
bopts , ok := options .(* buildapi.BuildLogOptions )
@@ -348,12 +347,20 @@ func NewFactory(clientConfig kclientcmd.ClientConfig) *Factory {
348
347
if bopts .Version != nil {
349
348
return nil , errors .New ("cannot specify a version and a build" )
350
349
}
350
+ oc , _ , err := w .Clients ()
351
+ if err != nil {
352
+ return nil , err
353
+ }
351
354
return oc .BuildLogs (t .Namespace ).Get (t .Name , * bopts ), nil
352
355
case * buildapi.BuildConfig :
353
356
bopts , ok := options .(* buildapi.BuildLogOptions )
354
357
if ! ok {
355
358
return nil , errors .New ("provided options object is not a BuildLogOptions" )
356
359
}
360
+ oc , _ , err := w .Clients ()
361
+ if err != nil {
362
+ return nil , err
363
+ }
357
364
builds , err := oc .Builds (t .Namespace ).List (api.ListOptions {})
358
365
if err != nil {
359
366
return nil , err
0 commit comments