Updates to Vnfs for nodeDB updates

This commit is contained in:
Gregory Kurtzer
2020-11-26 19:17:09 -08:00
parent dba9de2c8b
commit 082ab6e5f7

View File

@@ -23,12 +23,18 @@ type VnfsObject struct {
func Load (name string) (VnfsObject, error) {
config := config.New()
var ret VnfsObject
if name == "" {
wwlog.Printf(wwlog.DEBUG, "Called vnfs.Load() without a name, returning error\n")
return ret, errors.New("Called vnfs.Load() without a VNFS name")
}
pathFriendlyName := CleanName(name)
configFile := path.Join(config.VnfsImageDir(pathFriendlyName), "config.yaml")
if util.IsFile(configFile) == false {
return ret, errors.New("No Configuration for VNFS name: " + configFile)
return ret, errors.New("VNFS has not been imported: " + name)
}
data, err := ioutil.ReadFile(configFile)
@@ -64,6 +70,11 @@ func New(source string) (VnfsObject, error) {
var ret VnfsObject
config := config.New()
if source == "" {
wwlog.Printf(wwlog.DEBUG, "Called vnfs.Load() without a name, returning error\n")
return ret, errors.New("Called vnfs.Load() without a VNFS name")
}
pathFriendlyName := CleanName(source)
if strings.HasPrefix(source, "/") == true {