Move configuration work to library

Signed-off-by: jcsiadal <jeremy.c.siadal@intel.com>

Update to support show correctly

Signed-off-by: jcsiadal <jeremy.c.siadal@intel.com>
This commit is contained in:
jcsiadal
2022-02-11 16:49:10 +00:00
parent 116d217f88
commit e7aac8773c
18 changed files with 521 additions and 510 deletions

View File

@@ -0,0 +1,32 @@
package configure
import (
"fmt"
"github.com/pkg/errors"
)
func Configure(s string, v bool) error {
if !v {
fmt.Printf("################################################################################\n")
fmt.Printf("Configuring: %s\n", s)
}
var err error
switch s {
case "DHCP":
err = configureDHCP(v)
case "hosts":
err = configureHosts(v)
case "NFS":
err = configureNFS(v)
case "SSH":
err = configureSSH(v)
case "TFTP":
err = configureTFTP(v)
}
if err != nil {
return errors.Wrap(err, "Failed to configure "+s)
}
return nil
}