From edeebfe54d1ca3f46c1c0bfb86846e54baf23708 Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Mon, 26 Aug 2019 12:45:49 +0200 Subject: [PATCH] Issue #21: base: Return error when BundleName is not set An empty bundle name does not make sense, so if its value is "", this means it was not set while it's mandatory. Return an error when this happens. This fixes https://github.com/code-ready/machine/issues/21 --- libmachine/drivers/base.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libmachine/drivers/base.go b/libmachine/drivers/base.go index 222d9335e2..8156b56a67 100644 --- a/libmachine/drivers/base.go +++ b/libmachine/drivers/base.go @@ -82,6 +82,9 @@ func (d *BaseDriver) ResolveStorePath(file string) string { } // Returns the name of the bundle which was used to create this machine -func (d* BaseDriver) GetBundleName() (string, error) { +func (d *BaseDriver) GetBundleName() (string, error) { + if d.BundleName == "" { + return "", errors.New("Bundle name is not set") + } return d.BundleName, nil }