Skip to content
Snippets Groups Projects
Commit 70a0d004 authored by André Sterba's avatar André Sterba
Browse files

Merge branch 'develop' into istaester/migrate-yang-models

parents ac247e55 4d3e04f1
No related branches found
No related tags found
1 merge request!303Migrate yang models in monorepo
Pipeline #100877 passed
This commit is part of merge request !303. Comments created here will be created in the context of that merge request.
...@@ -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
...@@ -718,7 +722,6 @@ func saveGenericClientStreamToFile(t GenericGrpcClient, filename string, id uuid ...@@ -718,7 +722,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
...@@ -728,7 +731,6 @@ func saveGenericClientStreamToFile(t GenericGrpcClient, filename string, id uuid ...@@ -728,7 +731,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