Fixed formatting across entire project

This commit is contained in:
Gregory Kurtzer
2021-08-21 08:04:47 -07:00
parent 4d37c87c7b
commit a82e1b0ea5
20 changed files with 41 additions and 40 deletions

View File

@@ -3,8 +3,8 @@ package main
import ( import (
"fmt" "fmt"
"os"
"github.com/hpcng/warewulf/internal/app/wwctl" "github.com/hpcng/warewulf/internal/app/wwctl"
"os"
) )
func main() { func main() {

View File

@@ -3,8 +3,8 @@ package main
import ( import (
"fmt" "fmt"
"os"
"github.com/hpcng/warewulf/internal/app/wwctl" "github.com/hpcng/warewulf/internal/app/wwctl"
"os"
) )
func main() { func main() {

View File

@@ -9,4 +9,3 @@ func main() {
root.Execute() root.Execute()
} }

View File

@@ -1,3 +1,4 @@
//go:build linux
// +build linux // +build linux
package child package child

View File

@@ -1,3 +1,4 @@
//go:build !linux
// +build !linux // +build !linux
package child package child

View File

@@ -1,3 +1,4 @@
//go:build linux
// +build linux // +build linux
package exec package exec

View File

@@ -1,3 +1,4 @@
//go:build !linux
// +build !linux // +build !linux
package exec package exec

View File

@@ -24,15 +24,15 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
} }
fmt.Printf("Added node: %s\n", a) fmt.Printf("Added node: %s\n", a)
if SetClusterName != "" { if SetClusterName != "" {
wwlog.Printf(wwlog.VERBOSE, "Node: %s, Setting cluster name to: %s\n", n.Id.Get(), SetClusterName) wwlog.Printf(wwlog.VERBOSE, "Node: %s, Setting cluster name to: %s\n", n.Id.Get(), SetClusterName)
n.ClusterName.Set(SetClusterName) n.ClusterName.Set(SetClusterName)
err := nodeDB.NodeUpdate(n) err := nodeDB.NodeUpdate(n)
if err != nil { if err != nil {
wwlog.Printf(wwlog.ERROR, "%s\n", err) wwlog.Printf(wwlog.ERROR, "%s\n", err)
os.Exit(1) os.Exit(1)
} }
} }
if SetIpaddr != "" { if SetIpaddr != "" {
if SetNetDev == "" { if SetNetDev == "" {

View File

@@ -11,8 +11,8 @@ var (
RunE: CobraRunE, RunE: CobraRunE,
Aliases: []string{"rm", "del"}, Aliases: []string{"rm", "del"},
} }
SetYes bool SetYes bool
SetForce string SetForce string
) )
func init() { func init() {

View File

@@ -51,7 +51,6 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "IpmiUserName", node.IpmiUserName.Source(), node.IpmiUserName.Print()) fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "IpmiUserName", node.IpmiUserName.Source(), node.IpmiUserName.Print())
fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "IpmiInterface", node.IpmiInterface.Source(), node.IpmiInterface.Print()) fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "IpmiInterface", node.IpmiInterface.Source(), node.IpmiInterface.Print())
for name, netdev := range node.NetDevs { for name, netdev := range node.NetDevs {
fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), name+":HWADDR", netdev.Hwaddr.Source(), netdev.Hwaddr.Print()) fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), name+":HWADDR", netdev.Hwaddr.Source(), netdev.Hwaddr.Print())
fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), name+":IPADDR", netdev.Ipaddr.Source(), netdev.Ipaddr.Print()) fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), name+":IPADDR", netdev.Ipaddr.Source(), netdev.Ipaddr.Print())

View File

@@ -58,7 +58,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
User: node.IpmiUserName.Get(), User: node.IpmiUserName.Get(),
Password: node.IpmiPassword.Get(), Password: node.IpmiPassword.Get(),
Interface: ipmiInterface, Interface: ipmiInterface,
AuthType: "MD5", AuthType: "MD5",
} }
fullFlag := full fullFlag := full

View File

@@ -117,7 +117,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
} }
var unconfigured bool var unconfigured bool
for overlay, _ := range set { for overlay := range set {
var overlayPath string var overlayPath string
if SystemOverlay == true { if SystemOverlay == true {

View File

@@ -58,7 +58,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
User: node.IpmiUserName.Get(), User: node.IpmiUserName.Get(),
Password: node.IpmiPassword.Get(), Password: node.IpmiPassword.Get(),
Interface: ipmiInterface, Interface: ipmiInterface,
AuthType: "MD5", AuthType: "MD5",
} }
batchpool.Submit(func() { batchpool.Submit(func() {

View File

@@ -58,7 +58,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
User: node.IpmiUserName.Get(), User: node.IpmiUserName.Get(),
Password: node.IpmiPassword.Get(), Password: node.IpmiPassword.Get(),
Interface: ipmiInterface, Interface: ipmiInterface,
AuthType: "MD5", AuthType: "MD5",
} }
batchpool.Submit(func() { batchpool.Submit(func() {

View File

@@ -58,7 +58,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
User: node.IpmiUserName.Get(), User: node.IpmiUserName.Get(),
Password: node.IpmiPassword.Get(), Password: node.IpmiPassword.Get(),
Interface: ipmiInterface, Interface: ipmiInterface,
AuthType: "MD5", AuthType: "MD5",
} }
batchpool.Submit(func() { batchpool.Submit(func() {

View File

@@ -1,7 +1,6 @@
package wwctl package wwctl
import ( import (
"io"
"github.com/hpcng/warewulf/internal/app/wwctl/configure" "github.com/hpcng/warewulf/internal/app/wwctl/configure"
"github.com/hpcng/warewulf/internal/app/wwctl/container" "github.com/hpcng/warewulf/internal/app/wwctl/container"
"github.com/hpcng/warewulf/internal/app/wwctl/kernel" "github.com/hpcng/warewulf/internal/app/wwctl/kernel"
@@ -14,6 +13,7 @@ import (
"github.com/hpcng/warewulf/internal/pkg/wwlog" "github.com/hpcng/warewulf/internal/pkg/wwlog"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/spf13/cobra/doc" "github.com/spf13/cobra/doc"
"io"
) )
var ( var (
@@ -64,13 +64,13 @@ func rootPersistentPreRunE(cmd *cobra.Command, args []string) error {
// GenBashCompletionFile // GenBashCompletionFile
func GenBashCompletion(w io.Writer) error { func GenBashCompletion(w io.Writer) error {
return rootCmd.GenBashCompletion(w) return rootCmd.GenBashCompletion(w)
} }
func GenManTree(fileName string) error{ func GenManTree(fileName string) error {
header := &doc.GenManHeader{ header := &doc.GenManHeader{
Title: "MINE", Title: "MINE",
Section: "1", Section: "1",
} }
return doc.GenManTree(rootCmd,header,fileName) return doc.GenManTree(rootCmd, header, fileName)
} }

View File

@@ -29,7 +29,7 @@ type NodeConf struct {
IpmiIpaddr string `yaml:"ipmi ipaddr,omitempty"` IpmiIpaddr string `yaml:"ipmi ipaddr,omitempty"`
IpmiNetmask string `yaml:"ipmi netmask,omitempty"` IpmiNetmask string `yaml:"ipmi netmask,omitempty"`
IpmiGateway string `yaml:"ipmi gateway,omitempty"` IpmiGateway string `yaml:"ipmi gateway,omitempty"`
IpmiInterface string `yaml:"ipmi interface,omitempty"` IpmiInterface string `yaml:"ipmi interface,omitempty"`
RuntimeOverlay string `yaml:"runtime overlay,omitempty"` RuntimeOverlay string `yaml:"runtime overlay,omitempty"`
SystemOverlay string `yaml:"system overlay,omitempty"` SystemOverlay string `yaml:"system overlay,omitempty"`
Init string `yaml:"init,omitempty"` Init string `yaml:"init,omitempty"`
@@ -107,8 +107,8 @@ func init() {
c, err := os.OpenFile(ConfigFile, os.O_RDWR|os.O_CREATE, 0644) c, err := os.OpenFile(ConfigFile, os.O_RDWR|os.O_CREATE, 0644)
if err != nil { if err != nil {
wwlog.Printf(wwlog.ERROR, "Could not create new configuration file: %s\n", err) wwlog.Printf(wwlog.ERROR, "Could not create new configuration file: %s\n", err)
// just return silently, as init is also called for bash_completion // just return silently, as init is also called for bash_completion
return return
} }
fmt.Fprintf(c, "nodeprofiles:\n") fmt.Fprintf(c, "nodeprofiles:\n")

View File

@@ -16,8 +16,8 @@ type IPMI struct {
User string User string
Password string Password string
AuthType string AuthType string
Interface string Interface string
result IPMIResult result IPMIResult
} }
func (ipmi *IPMI) Result() (string, error) { func (ipmi *IPMI) Result() (string, error) {
@@ -28,9 +28,9 @@ func (ipmi *IPMI) Command(ipmiArgs []string) ([]byte, error) {
var args []string var args []string
if ipmi.Interface == "" { if ipmi.Interface == "" {
ipmi.Interface = "lanplus" ipmi.Interface = "lanplus"
} }
args = append(args, "-I", ipmi.Interface, "-H", ipmi.HostName, "-U", ipmi.User, "-P", ipmi.Password) args = append(args, "-I", ipmi.Interface, "-H", ipmi.HostName, "-U", ipmi.User, "-P", ipmi.Password)
args = append(args, ipmiArgs...) args = append(args, ipmiArgs...)
ipmiCmd := exec.Command("ipmitool", args...) ipmiCmd := exec.Command("ipmitool", args...)
@@ -41,9 +41,9 @@ func (ipmi *IPMI) InteractiveCommand(ipmiArgs []string) error {
var args []string var args []string
if ipmi.Interface == "" { if ipmi.Interface == "" {
ipmi.Interface = "lan" ipmi.Interface = "lan"
} }
args = append(args, "-I", ipmi.Interface, "-H", ipmi.HostName, "-U", ipmi.User, "-P", ipmi.Password) args = append(args, "-I", ipmi.Interface, "-H", ipmi.HostName, "-U", ipmi.User, "-P", ipmi.Password)
args = append(args, ipmiArgs...) args = append(args, ipmiArgs...)

View File

@@ -1,7 +1,6 @@
package warewulfconf package warewulfconf
import ( import (
"github.com/hpcng/warewulf/internal/pkg/util" "github.com/hpcng/warewulf/internal/pkg/util"
"github.com/hpcng/warewulf/internal/pkg/wwlog" "github.com/hpcng/warewulf/internal/pkg/wwlog"
) )
@@ -51,7 +50,7 @@ func init() {
//TODO: Check to make sure nodes.conf is found //TODO: Check to make sure nodes.conf is found
if util.IsFile(ConfigFile) == false { if util.IsFile(ConfigFile) == false {
wwlog.Printf(wwlog.ERROR, "Configuration file not found: %s\n", ConfigFile) wwlog.Printf(wwlog.ERROR, "Configuration file not found: %s\n", ConfigFile)
// fail silently as this also called by bash_completion // fail silently as this also called by bash_completion
return return
} }
} }