mirror of
https://github.com/davidallendj/configurator.git
synced 2025-12-20 03:27:02 -07:00
chore: tidy and code cleanup
This commit is contained in:
parent
d2b6178350
commit
ad45a540f0
6 changed files with 7 additions and 14 deletions
|
|
@ -1,8 +1,7 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/OpenCHAMI/configurator/pkg/config"
|
||||
|
|
@ -20,7 +19,7 @@ var configCmd = &cobra.Command{
|
|||
for _, path := range args {
|
||||
// check and make sure something doesn't exist first
|
||||
if exists, err := util.PathExists(path); exists || err != nil {
|
||||
fmt.Printf("file or directory exists\n")
|
||||
log.Error().Err(err).Msg("file or directory exists")
|
||||
continue
|
||||
}
|
||||
config.SaveDefault(path)
|
||||
|
|
|
|||
1
go.mod
1
go.mod
|
|
@ -41,4 +41,3 @@ require (
|
|||
golang.org/x/text v0.16.0 // indirect
|
||||
)
|
||||
|
||||
replace github.com/OpenCHAMI/configurator/pkg => ./pkg
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import (
|
|||
"net/http"
|
||||
|
||||
configurator "github.com/OpenCHAMI/configurator/pkg"
|
||||
"github.com/caarlos0/log"
|
||||
)
|
||||
|
||||
// An struct that's meant to extend functionality of the base HTTP client by
|
||||
|
|
@ -57,7 +58,7 @@ func (client *SmdClient) FetchEthernetInterfaces(verbose bool) ([]configurator.E
|
|||
|
||||
// print what we got if verbose is set
|
||||
if verbose {
|
||||
fmt.Printf("Ethernet Interfaces: %v\n", string(bytes))
|
||||
log.Info().Str("ethernet_interfaces", string(bytes)).Msg("found interfaces")
|
||||
}
|
||||
|
||||
return eths, nil
|
||||
|
|
@ -99,7 +100,7 @@ func (client *SmdClient) FetchComponents(verbose bool) ([]configurator.Component
|
|||
|
||||
// print what we got if verbose is set
|
||||
if verbose {
|
||||
fmt.Printf("Components: %v\n", string(bytes))
|
||||
log.Info().Str("components", string(bytes)).Msg("found components")
|
||||
}
|
||||
|
||||
return comps, nil
|
||||
|
|
@ -138,7 +139,7 @@ func (client *SmdClient) FetchRedfishEndpoints(verbose bool) ([]configurator.Red
|
|||
|
||||
// show the final result
|
||||
if verbose {
|
||||
fmt.Printf("Redfish endpoints: %v\n", string(b))
|
||||
log.Info().Str("redfish_endpoints", string(b)).Msg("found redfish endpoints")
|
||||
}
|
||||
|
||||
return eps, nil
|
||||
|
|
|
|||
|
|
@ -54,10 +54,6 @@ func (g *DHCPd) Generate(config *config.Config, params Params) (FileMap, error)
|
|||
computeNodes += fmt.Sprintf("host %s { hardware ethernet %s; fixed-address %s} ", eth.ComponentId, eth.MacAddress, eth.IpAddresses[0])
|
||||
}
|
||||
computeNodes += "# ====================================================================="
|
||||
|
||||
if params.Verbose {
|
||||
fmt.Printf("")
|
||||
}
|
||||
return ApplyTemplates(Mappings{
|
||||
"plugin_name": g.GetName(),
|
||||
"plugin_version": g.GetVersion(),
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ func LoadPlugins(dirpath string, opts ...Option) (map[string]Generator, error) {
|
|||
|
||||
// show the plugins found if verbose flag is set
|
||||
if params.Verbose {
|
||||
fmt.Printf("-- found plugin '%s'\n", gen.GetName())
|
||||
log.Info().Str("plugin_name", gen.GetName()).Msg("found plugin")
|
||||
}
|
||||
|
||||
// map each generator plugin by name for lookup
|
||||
|
|
|
|||
|
|
@ -23,8 +23,6 @@ var (
|
|||
err error
|
||||
)
|
||||
|
||||
const ()
|
||||
|
||||
// A valid test generator that implements the `Generator` interface.
|
||||
type TestGenerator struct{}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue