Skip to content
Snippets Groups Projects
Commit 4d3e04f1 authored by Fabian Seidl's avatar Fabian Seidl
Browse files

Investigate and handle vulnerabilities form scan

See merge request !307
parent 5f250c22
No related branches found
No related tags found
2 merge requests!307Investigate and handle vulnerabilities form scan,!264WIP: Develop
Pipeline #100876 passed
...@@ -68,7 +68,11 @@ var changeListCmd = &cobra.Command{ ...@@ -68,7 +68,11 @@ var changeListCmd = &cobra.Command{
} }
spinner.Success() spinner.Success()
pterm.DefaultTable.WithHasHeader().WithData(data).Render() err = pterm.DefaultTable.WithHasHeader().WithData(data).Render()
if err != nil {
return err
}
return nil return nil
}, },
} }
......
...@@ -60,7 +60,11 @@ var deviceListCmd = &cobra.Command{ ...@@ -60,7 +60,11 @@ var deviceListCmd = &cobra.Command{
spinner.Success() spinner.Success()
pterm.DefaultTable.WithHasHeader().WithData(data).Render() err = pterm.DefaultTable.WithHasHeader().WithData(data).Render()
if err != nil {
return err
}
return nil return nil
}, },
} }
......
...@@ -60,7 +60,11 @@ var pndListCmd = &cobra.Command{ ...@@ -60,7 +60,11 @@ var pndListCmd = &cobra.Command{
spinner.Success() spinner.Success()
pterm.DefaultTable.WithHasHeader().WithData(data).Render() err = pterm.DefaultTable.WithHasHeader().WithData(data).Render()
if err != nil {
return err
}
return nil return nil
}, },
} }
......
...@@ -67,7 +67,10 @@ The login command must be called for authorization. ...@@ -67,7 +67,10 @@ The login command must be called for authorization.
// Execute adds all child commands to the root command and sets flags appropriately. // Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd. // This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() { func Execute() {
rootCmd.Execute() err := rootCmd.Execute()
if err != nil {
log.Error("Could not execute root command: ", err)
}
//cobra.CheckErr(rootCmd.Execute()) //cobra.CheckErr(rootCmd.Execute())
} }
......
...@@ -100,7 +100,12 @@ func GetSbiSchemaTree(ctx context.Context, addr string, pid, sid uuid.UUID) (map ...@@ -100,7 +100,12 @@ func GetSbiSchemaTree(ctx context.Context, addr string, pid, sid uuid.UUID) (map
break break
} }
log.Error(err) log.Error(err)
sClient.CloseSend()
closeErr := sClient.CloseSend()
if closeErr != nil {
return nil, err
}
return map[string]*yang.Entry{}, err return map[string]*yang.Entry{}, err
} }
sTreeBytes = append(sTreeBytes, payload.Chunk...) sTreeBytes = append(sTreeBytes, payload.Chunk...)
......
...@@ -86,7 +86,11 @@ func NewPND( ...@@ -86,7 +86,11 @@ func NewPND(
if len(existingSBIs) == 0 { if len(existingSBIs) == 0 {
newSBI, _ := NewSBI(spb.Type_TYPE_OPENCONFIG) newSBI, _ := NewSBI(spb.Type_TYPE_OPENCONFIG)
pnd.sbic.Add(newSBI) err = pnd.sbic.Add(newSBI)
if err != nil {
return nil, err
}
} }
return pnd, nil return pnd, nil
...@@ -717,7 +721,6 @@ func saveGenericClientStreamToFile(t GenericGrpcClient, filename string, id uuid ...@@ -717,7 +721,6 @@ func saveGenericClientStreamToFile(t GenericGrpcClient, filename string, id uuid
if err == io.EOF { if err == io.EOF {
break break
} }
t.CloseSend()
closeErr := t.CloseSend() closeErr := t.CloseSend()
if closeErr != nil { if closeErr != nil {
return uuid.Nil, closeErr return uuid.Nil, closeErr
...@@ -727,7 +730,6 @@ func saveGenericClientStreamToFile(t GenericGrpcClient, filename string, id uuid ...@@ -727,7 +730,6 @@ func saveGenericClientStreamToFile(t GenericGrpcClient, filename string, id uuid
} }
n, err := f.Write(payload.Chunk) n, err := f.Write(payload.Chunk)
if err != nil { if err != nil {
t.CloseSend()
closeErr := t.CloseSend() closeErr := t.CloseSend()
if closeErr != nil { if closeErr != nil {
return uuid.Nil, closeErr return uuid.Nil, closeErr
......
...@@ -3,6 +3,7 @@ package proto ...@@ -3,6 +3,7 @@ package proto
import ( import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"path/filepath"
"google.golang.org/protobuf/proto" "google.golang.org/protobuf/proto"
) )
...@@ -29,7 +30,7 @@ func Write(message proto.Message, filename string) error { ...@@ -29,7 +30,7 @@ func Write(message proto.Message, filename string) error {
// Read reads a binary file (containing a marshaled protocol buffer message) // Read reads a binary file (containing a marshaled protocol buffer message)
// and unmarshals it back into a protocol buffer message // and unmarshals it back into a protocol buffer message
func Read(filename string, message proto.Message) error { func Read(filename string, message proto.Message) error {
data, err := ioutil.ReadFile(filename) data, err := ioutil.ReadFile(filepath.Clean(filename))
if err != nil { if err != nil {
return fmt.Errorf("cannot read binary data from file: %w", err) return fmt.Errorf("cannot read binary data from file: %w", err)
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment