Cleanups and removing the legacy wwclient program code

This commit is contained in:
Gregory Kurtzer
2020-11-11 15:10:48 -08:00
parent fff79227d8
commit 9644690dd5
9 changed files with 17 additions and 417 deletions

View File

@@ -3,6 +3,7 @@ package assets
import (
"fmt"
"github.com/hpcng/warewulf/internal/pkg/vnfs"
"github.com/hpcng/warewulf/internal/pkg/wwlog"
"gopkg.in/yaml.v2"
"io/ioutil"
"strings"
@@ -137,13 +138,16 @@ func FindAllNodes() ([]NodeInfo, error) {
n.Fqdn = node.Hostname
}
if strings.HasPrefix(n.Vnfs, "docker://") {
if b, _ := regexp.MatchString(`^[a-z\-]+://`, n.Vnfs); b == true {
//if strings.HasPrefix(n.Vnfs, "docker://") {
//TODO: This is a kludge and shouldn't be done here. We need to go back
// and do this from a "vnfs" interface or package
v := vnfs.New(n.Vnfs)
n.VnfsDir = v.Root()
} else {
} else if strings.HasPrefix(n.Vnfs, "/"){
n.VnfsDir = n.Vnfs
} else {
wwlog.Printf(wwlog.ERROR, "Configuration 'Vnfs' is invalid for node: %s\n", n.Fqdn)
}
ret = append(ret, n)

View File

@@ -7,10 +7,10 @@ import (
"io/ioutil"
)
// THIS IS NOT BEING USED YET AND IS THUS A WORK IN PROGRESS
const SysConfDir = "/etc/warewulf/"
const LocalStateDir = "/var/warewulf"
const (
SysConfDir = "/etc/warewulf/"
LocalStateDir = "/var/warewulf"
)
type Config struct {
Port int `yaml:"warewulfd port", envconfig:"WAREWULFD_PORT"`

View File

@@ -43,7 +43,7 @@ func (self *VnfsObject) NameClean() string {
}
uri := strings.Split(self.SourcePath, "://")
return strings.ReplaceAll(uri[1], "/", "_")
return strings.ReplaceAll(uri[0]+":"+uri[1], "/", "_")
}
func (self *VnfsObject) Source() string {

View File

@@ -22,7 +22,12 @@ var (
func SetLevel(level uint) {
logLevel = level
log.SetFlags(0)
if level == DEBUG {
log.SetFlags(log.Lmicroseconds)
} else {
log.SetFlags(0)
}
Printf(DEBUG, "Set log level to: %d\n", logLevel)
}