added new build in vars to rest of binaries

Signed-off-by: Christian Goll <cgoll@suse.de>
This commit is contained in:
Christian Goll
2023-03-03 16:21:44 +01:00
parent ca088d123d
commit b55473e1e4
7 changed files with 17 additions and 16 deletions

View File

@@ -8,7 +8,6 @@ import (
"github.com/hpcng/warewulf/cmd/update_configuration/vers42"
"github.com/hpcng/warewulf/cmd/update_configuration/vers43"
"github.com/hpcng/warewulf/internal/pkg/buildconfig"
"github.com/hpcng/warewulf/internal/pkg/util"
"gopkg.in/yaml.v2"
)
@@ -125,7 +124,7 @@ func main() {
var endVers int
var startVers int
flag.StringVar(&confFile, "f", "", "Config file for update")
flag.IntVar(&endVers, "e", buildconfig.WWVer, "Final version of configuration file")
flag.IntVar(&endVers, "e", 0, "Final version of configuration file")
flag.IntVar(&startVers, "s", 0, "Start version of configuration file, 0 is for autodetection")
flag.BoolVar(&nowrite, "n", false, "Do not write, just print new conf to terminal")
flag.BoolVar(&quiet, "q", false, "Do not print what the program is doing")

View File

@@ -12,7 +12,7 @@ import (
"github.com/hpcng/warewulf/internal/pkg/api/apiconfig"
"github.com/hpcng/warewulf/internal/pkg/api/routes/wwapiv1"
"github.com/hpcng/warewulf/internal/pkg/buildconfig"
"github.com/hpcng/warewulf/internal/pkg/warewulfconf"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
@@ -24,9 +24,10 @@ import (
func main() {
log.Println("Client running")
conf := warewulfconf.New()
// Read the config file.
config, err := apiconfig.NewClient(path.Join(buildconfig.SYSCONFDIR(), "warewulf/wwapic.conf"))
config, err := apiconfig.NewClient(path.Join(conf.SYSCONFDIR(), "warewulf/wwapic.conf"))
if err != nil {
log.Fatalf("err: %v", err)
}

View File

@@ -15,8 +15,8 @@ import (
"github.com/hpcng/warewulf/internal/pkg/api/container"
apinode "github.com/hpcng/warewulf/internal/pkg/api/node"
"github.com/hpcng/warewulf/internal/pkg/api/routes/wwapiv1"
"github.com/hpcng/warewulf/internal/pkg/buildconfig"
"github.com/hpcng/warewulf/internal/pkg/version"
"github.com/hpcng/warewulf/internal/pkg/warewulfconf"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials"
@@ -34,8 +34,9 @@ var apiVersion string
func main() {
log.Println("Server running")
conf := warewulfconf.New()
// Read the config file.
config, err := apiconfig.NewServer(path.Join(buildconfig.SYSCONFDIR(), "warewulf/wwapid.conf"))
config, err := apiconfig.NewServer(path.Join(conf.SYSCONFDIR(), "warewulf/wwapid.conf"))
if err != nil {
log.Fatalf("err: %v", err)
}

View File

@@ -18,20 +18,20 @@ import (
"google.golang.org/grpc/credentials/insecure"
"github.com/hpcng/warewulf/internal/pkg/api/apiconfig"
"github.com/hpcng/warewulf/internal/pkg/warewulfconf"
gw "github.com/hpcng/warewulf/internal/pkg/api/routes/wwapiv1"
"path"
"github.com/hpcng/warewulf/internal/pkg/buildconfig"
)
func run() error {
log.Println("test0")
conf := warewulfconf.New()
// Read the config file.
config, err := apiconfig.NewClientServer(path.Join(buildconfig.SYSCONFDIR(), "warewulf/wwapird.conf"))
config, err := apiconfig.NewClientServer(path.Join(conf.SYSCONFDIR(), "warewulf/wwapird.conf"))
if err != nil {
glog.Fatalf("Failed to read config file, err: %v", err)
}

View File

@@ -58,7 +58,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
return errors.New("found pidfile " + PIDFile + " not starting")
}
if os.Args[0] == path.Join(buildconfig.WWCLIENTDIR(), "wwclient") {
if os.Args[0] == path.Join(conf.WWCLIENTDIR(), "wwclient") {
err := os.Chdir("/")
if err != nil {
wwlog.Error("failed to change dir: %s", err)
@@ -70,7 +70,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
} else {
fmt.Printf("Called via: %s\n", os.Args[0])
fmt.Printf("Runtime overlay is being put in '/warewulf/wwclient-test' rather than '/'\n")
fmt.Printf("For full functionality call with: %s\n", path.Join(buildconfig.WWCLIENTDIR(), "wwclient"))
fmt.Printf("For full functionality call with: %s\n", path.Join(conf.WWCLIENTDIR(), "wwclient"))
err := os.MkdirAll("/warewulf/wwclient-test", 0755)
if err != nil {
wwlog.Error("failed to create dir: %s", err)

View File

@@ -63,7 +63,7 @@ func GetRootCommand() *cobra.Command {
return rootCmd
}
func rootPersistentPreRunE(cmd *cobra.Command, args []string) error {
func rootPersistentPreRunE(cmd *cobra.Command, args []string) (err error) {
if DebugFlag {
wwlog.SetLogLevel(wwlog.DEBUG)
} else if verboseArg {
@@ -76,9 +76,9 @@ func rootPersistentPreRunE(cmd *cobra.Command, args []string) error {
}
conf := warewulfconf.New()
if WarewulfConfArg != "" {
conf.ReadConf(WarewulfConfArg)
err = conf.ReadConf(WarewulfConfArg)
} else if os.Getenv("WAREWULFCONF") != "" {
conf.ReadConf(os.Getenv("WAREWULFCONF"))
err = conf.ReadConf(os.Getenv("WAREWULFCONF"))
}
return nil
return
}

View File

@@ -30,7 +30,7 @@ func New() (ret ControllerConf) {
ret.Nfs = new(NfsConf)
ret.Paths = new(BuildConfig)
_ = defaults.Set(&ret)
ret.setDynamicDefaults()
_ = ret.setDynamicDefaults()
cachedConf = ret
cachedConf.current = true