Skip to content

Commit

Permalink
Remove newlines from log lines, which are not required
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
  • Loading branch information
alexellis committed Sep 17, 2024
1 parent 1c1bfa6 commit 5b633cc
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 14 deletions.
8 changes: 6 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,16 @@ var rootCommand = &cobra.Command{
Use: "faasd",
Short: "Start faasd",
Long: `
faasd - Serverless For Everyone Else
faasd Community Edition (CE):
Learn how to build, secure, and monitor functions with faasd with
the eBook:
https://openfaas.gumroad.com/l/serverless-for-everyone-else
License: OpenFaaS CE EULA with faasd addendum:
https://github.com/openfaas/faasd/blob/master/EULA.md
`,
RunE: runRootCommand,
SilenceUsage: true,
Expand All @@ -68,7 +72,7 @@ func parseBaseCommand(_ *cobra.Command, _ []string) {
}

func printVersion() {
fmt.Printf("faasd version: %s\tcommit: %s\n", pkg.GetVersion(), pkg.GitCommit)
fmt.Printf("faasd Community Edition (CE) version: %s\tcommit: %s\n", pkg.GetVersion(), pkg.GitCommit)
}

func printLogo() {
Expand Down
7 changes: 5 additions & 2 deletions pkg/connectivity.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

// ConnectivityCheck checks if the controller can reach the
// public Internet via HTTPS.
// A license is required to use OpenFaaS for Commercial Use.
// A license is required to use OpenFaaS CE for Commercial Use.
func ConnectivityCheck() error {
req, err := http.NewRequest(http.MethodGet, "https://checkip.amazonaws.com", nil)
if err != nil {
Expand All @@ -27,7 +27,10 @@ func ConnectivityCheck() error {
}

if res.StatusCode != http.StatusOK {
body, _ := io.ReadAll(res.Body)
var body []byte
if res.Body != nil {
body, _ = io.ReadAll(res.Body)
}

return fmt.Errorf("unexpected status code checking connectivity: %d, body: %s", res.StatusCode, strings.TrimSpace(string(body)))
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/provider/handlers/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func MakeDeleteHandler(client *containerd.Client, cni gocni.CNI) func(w http.Res

req := types.DeleteFunctionRequest{}
if err := json.Unmarshal(body, &req); err != nil {
log.Printf("[Delete] error parsing input: %s\n", err)
log.Printf("[Delete] error parsing input: %s", err)
http.Error(w, err.Error(), http.StatusBadRequest)

return
Expand Down
2 changes: 1 addition & 1 deletion pkg/provider/handlers/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func MakeDeployHandler(client *containerd.Client, cni gocni.CNI, secretMountPath
req := types.FunctionDeployment{}
err := json.Unmarshal(body, &req)
if err != nil {
log.Printf("[Deploy] - error parsing input: %s\n", err)
log.Printf("[Deploy] - error parsing input: %s", err)
http.Error(w, err.Error(), http.StatusBadRequest)

return
Expand Down
2 changes: 1 addition & 1 deletion pkg/provider/handlers/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func MakeReadHandler(client *containerd.Client) func(w http.ResponseWriter, r *h
res := []types.FunctionStatus{}
fns, err := ListFunctions(client, lookupNamespace)
if err != nil {
log.Printf("[Read] error listing functions. Error: %s\n", err)
log.Printf("[Read] error listing functions. Error: %s", err)
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/provider/handlers/scale.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func MakeReplicaUpdateHandler(client *containerd.Client, cni gocni.CNI) func(w h

req := types.ScaleServiceRequest{}
if err := json.Unmarshal(body, &req); err != nil {
log.Printf("[Scale] error parsing input: %s\n", err)
log.Printf("[Scale] error parsing input: %s", err)
http.Error(w, err.Error(), http.StatusBadRequest)

return
Expand Down
2 changes: 1 addition & 1 deletion pkg/provider/handlers/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func listSecrets(store provider.Labeller, w http.ResponseWriter, r *http.Request
}

if err != nil {
fmt.Printf("Error Occured: %s \n", err)
log.Printf("[Secret] Error listing secrets: %s ", err)
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/provider/handlers/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func MakeUpdateHandler(client *containerd.Client, cni gocni.CNI, secretMountPath
req := types.FunctionDeployment{}
err := json.Unmarshal(body, &req)
if err != nil {
log.Printf("[Update] error parsing input: %s\n", err)
log.Printf("[Update] error parsing input: %s", err)
http.Error(w, err.Error(), http.StatusBadRequest)

return
Expand Down
8 changes: 4 additions & 4 deletions pkg/supervisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,15 @@ func (s *Supervisor) Start(svcs []Service) error {
)

if err != nil {
log.Printf("Error creating container: %s\n", err)
log.Printf("Error creating container: %s", err)
return err
}

log.Printf("Created container: %s\n", newContainer.ID())

task, err := newContainer.NewTask(ctx, cio.BinaryIO("/usr/local/bin/faasd", nil))
if err != nil {
log.Printf("Error creating task: %s\n", err)
log.Printf("Error creating task: %s", err)
return err
}

Expand Down Expand Up @@ -268,15 +268,15 @@ func (s *Supervisor) Start(svcs []Service) error {
}

if _, err := task.Wait(ctx); err != nil {
log.Printf("Task wait error: %s\n", err)
log.Printf("Task wait error: %s", err)
return err
}

log.Printf("Task: %s\tContainer: %s\n", task.ID(), newContainer.ID())
// log.Println("Exited: ", exitStatusC)

if err = task.Start(ctx); err != nil {
log.Printf("Task start error: %s\n", err)
log.Printf("Task start error: %s", err)
return err
}
}
Expand Down

0 comments on commit 5b633cc

Please sign in to comment.