Merge pull request #808 from hpcng/FixWWclient
fix warewulf.conf location for wwclient
This commit is contained in:
29
CHANGELOG.md
29
CHANGELOG.md
@@ -40,19 +40,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
- The primary hostname and warewulf server fqdn are now the canonical name in
|
||||
`/etc/hosts`
|
||||
- new subcommand `wwctl genconf` is available with following subcommands:
|
||||
* `completions` which will create the files used for bash-completion. Also
|
||||
fish an zsh completions can be generated
|
||||
* `defaults` which will generate a valid `defaults.conf`
|
||||
* `man` which will generate the man pages in the specified directory
|
||||
* `reference` which will generate a reference documentation for the wwctl commands
|
||||
* `warwulfconf print` which will print the used `warewulf.conf`. If there is no valid
|
||||
`warewulf.conf` a valid configuration is provided, prefilled with default values
|
||||
and an IP configuration derived from the network configuration of the host
|
||||
- All paths can now be configured in `warewulf.conf`, check the paths section of of
|
||||
`wwctl --emptyconf genconfig warewulfconf print` for the available paths.
|
||||
- Added experimental dnsmasq support.
|
||||
|
||||
- Refactored `profile add` command to make it alike `node add`. #658 #659
|
||||
|
||||
- The ifcfg ONBOOT parameter is no longer statically `true`, so unconfigured
|
||||
interfaces may not be enabled by default. (#644)
|
||||
|
||||
@@ -65,22 +55,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
* `warwulfconf print` which will print the used `warewulf.conf`. If there is no valid
|
||||
`warewulf.conf` a valid configuration is provided, prefilled with default values
|
||||
and an IP configuration derived from the network configuration of the host
|
||||
|
||||
- All paths can now be configured in `warewulf.conf`, check the paths section of of
|
||||
`wwctl --emptyconf genconfig warewulfconf print` for the available paths.
|
||||
|
||||
- Added experimental dnsmasq support.
|
||||
|
||||
- new subcommand `wwctl genconf` is available with following subcommands:
|
||||
* `completions` which will create the files used for bash-completion. Also
|
||||
fish an zsh completions can be generated
|
||||
* `defaults` which will generate a valid `defaults.conf`
|
||||
* `man` which will generate the man pages in the specified directory
|
||||
* `reference` which will generate a reference documentation for the wwctl commands
|
||||
* `warwulfconf print` which will print the used `warewulf.conf`. If there is no valid
|
||||
`warewulf.conf` a valid configuration is provided, prefilled with default values
|
||||
and an IP configuration derived from the network configuration of the host
|
||||
- All paths can now be configured in `warewulf.conf`, check the paths section of of
|
||||
`wwctl --emptyconf genconfig warewulfconf print` for the available paths.
|
||||
- Added experimental dnsmasq support.
|
||||
- Check for formal correct IP and MAC addresses for command line options and
|
||||
when reading in the configurations
|
||||
- Write log messages to stderr rather than stdout. #768
|
||||
@@ -111,6 +91,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
file is create and will executed after the `ignition-disks-ww4.service` has finished.
|
||||
Entries in `/etc/fstab` for every file system are created with the `noauto` option.
|
||||
|
||||
- wwclient has now a commandline switch for the location of warewulf.conf
|
||||
## [4.4.0] 2023-01-18
|
||||
|
||||
### Added
|
||||
|
||||
@@ -16,8 +16,8 @@ import (
|
||||
|
||||
"github.com/coreos/go-systemd/daemon"
|
||||
"github.com/google/uuid"
|
||||
"github.com/hpcng/warewulf/internal/pkg/pidfile"
|
||||
warewulfconf "github.com/hpcng/warewulf/internal/pkg/config"
|
||||
"github.com/hpcng/warewulf/internal/pkg/pidfile"
|
||||
"github.com/hpcng/warewulf/internal/pkg/wwlog"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/talos-systems/go-smbios/smbios"
|
||||
@@ -31,14 +31,16 @@ var (
|
||||
RunE: CobraRunE,
|
||||
SilenceUsage: true,
|
||||
}
|
||||
DebugFlag bool
|
||||
PIDFile string
|
||||
Webclient *http.Client
|
||||
DebugFlag bool
|
||||
PIDFile string
|
||||
Webclient *http.Client
|
||||
WarewulfConfArg string
|
||||
)
|
||||
|
||||
func init() {
|
||||
rootCmd.PersistentFlags().BoolVarP(&DebugFlag, "debug", "d", false, "Run with debugging messages enabled.")
|
||||
rootCmd.PersistentFlags().StringVarP(&PIDFile, "pidfile", "p", "/var/run/wwclient.pid", "PIDFile to use")
|
||||
rootCmd.PersistentFlags().StringVar(&WarewulfConfArg, "warewulfconf", "", "Set the warewulf configuration file")
|
||||
|
||||
}
|
||||
|
||||
@@ -48,9 +50,18 @@ func GetRootCommand() *cobra.Command {
|
||||
return rootCmd
|
||||
}
|
||||
|
||||
func CobraRunE(cmd *cobra.Command, args []string) error {
|
||||
func CobraRunE(cmd *cobra.Command, args []string) (err error) {
|
||||
conf := warewulfconf.Get()
|
||||
|
||||
if WarewulfConfArg != "" {
|
||||
err = conf.Read(WarewulfConfArg)
|
||||
} else if os.Getenv("WAREWULFCONF") != "" {
|
||||
err = conf.Read(os.Getenv("WAREWULFCONF"))
|
||||
} else {
|
||||
err = conf.Read(warewulfconf.ConfigFile)
|
||||
}
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
pid, err := pidfile.Write(PIDFile)
|
||||
if err != nil && pid == -1 {
|
||||
wwlog.Warn("%v. starting new wwclient", err)
|
||||
|
||||
Reference in New Issue
Block a user