From 5d84cb9dd73e18c8c2d63911f3c132c383776f26 Mon Sep 17 00:00:00 2001 From: Yvonnick Esnault Date: Sun, 28 Jun 2020 23:23:25 +0200 Subject: [PATCH 1/2] fix(hatchery/vsphere): init endpoint close #5281 initial commit https://github.com/ovh/cds/commit/c389564867fa7be76441c13d302c311dd42a94f8 Signed-off-by: Yvonnick Esnault --- engine/hatchery/vsphere/init.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engine/hatchery/vsphere/init.go b/engine/hatchery/vsphere/init.go index 90f99e0b41..099b72dc47 100644 --- a/engine/hatchery/vsphere/init.go +++ b/engine/hatchery/vsphere/init.go @@ -13,6 +13,11 @@ import ( // InitHatchery create new client for vsphere func (h *HatcheryVSphere) InitHatchery(ctx context.Context) error { + + h.user = h.Config.VSphereUser + h.password = h.Config.VSpherePassword + h.endpoint = h.Config.VSphereEndpoint + // Connect and login to ESX or vCenter c, errNc := h.newClient(ctx) if errNc != nil { From a0c19b34eea92fb9befab4b5a9788567f2f1b5e9 Mon Sep 17 00:00:00 2001 From: Yvonnick Esnault Date: Sun, 28 Jun 2020 23:27:06 +0200 Subject: [PATCH 2/2] fix: cr Signed-off-by: Yvonnick Esnault --- engine/hatchery/vsphere/init.go | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/engine/hatchery/vsphere/init.go b/engine/hatchery/vsphere/init.go index 099b72dc47..33df197c30 100644 --- a/engine/hatchery/vsphere/init.go +++ b/engine/hatchery/vsphere/init.go @@ -13,30 +13,27 @@ import ( // InitHatchery create new client for vsphere func (h *HatcheryVSphere) InitHatchery(ctx context.Context) error { - h.user = h.Config.VSphereUser h.password = h.Config.VSpherePassword h.endpoint = h.Config.VSphereEndpoint // Connect and login to ESX or vCenter - c, errNc := h.newClient(ctx) - if errNc != nil { - return fmt.Errorf("Unable to vsphere.newClient: %s", errNc) + c, err := h.newClient(ctx) + if err != nil { + return fmt.Errorf("Unable to vsphere.newClient: %v", err) } h.vclient = c finder := find.NewFinder(h.vclient.Client, false) h.finder = finder - var errDc error - if h.datacenter, errDc = finder.DatacenterOrDefault(ctx, h.datacenterString); errDc != nil { - return fmt.Errorf("Unable to find datacenter %s : %s", h.datacenterString, errDc) + if h.datacenter, err = finder.DatacenterOrDefault(ctx, h.datacenterString); err != nil { + return fmt.Errorf("Unable to find datacenter %s: %v", h.datacenterString, err) } finder.SetDatacenter(h.datacenter) - var errN error - if h.network, errN = finder.NetworkOrDefault(ctx, h.networkString); errN != nil { - return fmt.Errorf("Unable to find network %s : %s", h.networkString, errN) + if h.network, err = finder.NetworkOrDefault(ctx, h.networkString); err != nil { + return fmt.Errorf("Unable to find network %s: %v", h.networkString, err) } go h.main()