Skip to content

Commit

Permalink
Merge pull request #600 from carlmontanari/scrapli-cleanup-changes
Browse files Browse the repository at this point in the history
making sure scrapli cleanup doesnt break things!
  • Loading branch information
hellt committed Sep 1, 2021
2 parents f40c84e + a151e64 commit 947e5b9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ require (
github.com/olekukonko/tablewriter v0.0.5-0.20201029120751-42e21c7531a3
github.com/opencontainers/runtime-spec v1.0.3-0.20210303205135-43e4633e40c1
github.com/pkg/errors v0.9.1
github.com/scrapli/scrapligo v0.0.0-20210822185345-c949ba367b79
github.com/scrapli/scrapligo v0.1.0
github.com/sirupsen/logrus v1.8.1
github.com/spf13/cobra v1.0.0
github.com/srl-labs/srlinux-scrapli v0.2.0
github.com/srl-labs/srlinux-scrapli v0.3.0
github.com/vishvananda/netlink v1.1.1-0.20210330154013-f5de75959ad5
github.com/weaveworks/ignite v0.9.1-0.20210705155449-2dbcdd663727
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b
Expand Down
9 changes: 4 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -920,9 +920,8 @@ github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD
github.com/safchain/ethtool v0.0.0-20190326074333-42ed695e3de8 h1:2c1EFnZHIPCW8qKWgHMH/fX2PkSabFc5mrVzfUNdg5U=
github.com/safchain/ethtool v0.0.0-20190326074333-42ed695e3de8/go.mod h1:Z0q5wiBQGYcxhMZ6gUqHn6pYNLypFAvaL3UvgZLR0U4=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/scrapli/scrapligo v0.0.0-20210814224131-df0e66d7cd23/go.mod h1:0tHMgiCiTuWOvSceFU7klaYThXvRZNvc7k+fmQrtH54=
github.com/scrapli/scrapligo v0.0.0-20210822185345-c949ba367b79 h1:fFnWvBZu5CLbZ5lKP7HJzOygxDQFWoDC6pVs1Yc44RQ=
github.com/scrapli/scrapligo v0.0.0-20210822185345-c949ba367b79/go.mod h1:0tHMgiCiTuWOvSceFU7klaYThXvRZNvc7k+fmQrtH54=
github.com/scrapli/scrapligo v0.1.0 h1:6bAtdQY9Phnacy811lf8kgoWqIMYAM/E3b5N07wVbyU=
github.com/scrapli/scrapligo v0.1.0/go.mod h1:0tHMgiCiTuWOvSceFU7klaYThXvRZNvc7k+fmQrtH54=
github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo=
github.com/securego/gosec v0.0.0-20191002120514-e680875ea14d/go.mod h1:w5+eXa0mYznDkHaMCXA4XYffjlH+cy1oyKbfzJXa2Do=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
Expand Down Expand Up @@ -969,8 +968,8 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE=
github.com/srl-labs/srlinux-scrapli v0.2.0 h1:uBvD7E326ucH1AKfe0ufo9063MAa+rTeIJSeBBZXy6o=
github.com/srl-labs/srlinux-scrapli v0.2.0/go.mod h1:j4SjAR3WX5OdjTSTaU8IJn4V7Hv6ateazBhI36AyKCk=
github.com/srl-labs/srlinux-scrapli v0.3.0 h1:TgLYx5RKd8AbpzR1yXoGrlcCB311kYcSpW9PVT7+Zqs=
github.com/srl-labs/srlinux-scrapli v0.3.0/go.mod h1:v3/kQGV9V6qFYJGqL7+4+kiDqq2HZ+03z9WKiN8VYoQ=
github.com/stefanberger/go-pkcs11uri v0.0.0-20201008174630-78d3cae3a980/go.mod h1:AO3tvPzVZ/ayst6UlUKUv6rcPQInYe3IknH3jYhAKu8=
github.com/stretchr/objx v0.0.0-20180129172003-8a3f7159479f/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand Down
10 changes: 5 additions & 5 deletions nodes/ceos/ceos.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (s *ceos) Init(cfg *types.NodeConfig, opts ...nodes.NodeOption) error {

func (s *ceos) Config() *types.NodeConfig { return s.cfg }

func (s *ceos) PreDeploy(configName, labCADir, labCARoot string) error {
func (s *ceos) PreDeploy(_, _, _ string) error {
utils.CreateDirectory(s.cfg.LabDir, 0777)
return createCEOSFiles(s.cfg)
}
Expand All @@ -87,12 +87,12 @@ func (s *ceos) Deploy(ctx context.Context) error {
return err
}

func (s *ceos) PostDeploy(ctx context.Context, ns map[string]nodes.Node) error {
func (s *ceos) PostDeploy(ctx context.Context, _ map[string]nodes.Node) error {
log.Infof("Running postdeploy actions for Arista cEOS '%s' node", s.cfg.ShortName)
return ceosPostDeploy(ctx, s.runtime, s.cfg)
}

func (s *ceos) WithMgmtNet(*types.MgmtNet) {}
func (*ceos) WithMgmtNet(*types.MgmtNet) {}
func (s *ceos) WithRuntime(r runtime.ContainerRuntime) { s.runtime = r }
func (s *ceos) GetRuntime() runtime.ContainerRuntime { return s.runtime }

Expand Down Expand Up @@ -143,7 +143,7 @@ func createCEOSFiles(node *types.NodeConfig) error {
}

// ceosPostDeploy runs postdeploy actions which are required for ceos nodes
func ceosPostDeploy(ctx context.Context, r runtime.ContainerRuntime, node *types.NodeConfig) error {
func ceosPostDeploy(_ context.Context, _ runtime.ContainerRuntime, node *types.NodeConfig) error {
d, err := utils.SpawnCLIviaExec("arista_eos", node.LongName)
if err != nil {
return err
Expand Down Expand Up @@ -177,7 +177,7 @@ func ceosPostDeploy(ctx context.Context, r runtime.ContainerRuntime, node *types
resp, err := d.SendConfigs(cfgs)
if err != nil {
return err
} else if resp.Failed() {
} else if resp.Failed != nil {
return errors.New("failed CLI configuration")
}

Expand Down
6 changes: 3 additions & 3 deletions utils/networkcli.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ func SpawnCLIviaExec(platform, contName string) (*network.Driver, error) {
execCmd := "docker"
openCmd := []string{"exec", "-it"}

t, _ := d.Transport.(*transport.System)
t.ExecCmd = execCmd
t.OpenCmd = append(openCmd, contName, NetworkOSCLICmd[platform])
t, _ := d.Transport.Impl.(transport.SystemTransport)
t.SetExecCmd(execCmd)
t.SetOpenCmd(append(openCmd, contName, NetworkOSCLICmd[platform]))

transportReady := false
for !transportReady {
Expand Down

0 comments on commit 947e5b9

Please sign in to comment.