added new build in vars to rest of binaries
Signed-off-by: Christian Goll <cgoll@suse.de>
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user