Skip to content

Commit

Permalink
only add additional config if not startup nor existing cfg present
Browse files Browse the repository at this point in the history
  • Loading branch information
hellt committed Sep 10, 2021
1 parent 4a189b5 commit eb11522
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
19 changes: 11 additions & 8 deletions nodes/srl/srl.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,18 @@ func (s *srl) Deploy(ctx context.Context) error {
return err
}

func (s *srl) PostDeploy(ctx context.Context, ns map[string]nodes.Node) error {
if s.cfg.StartupConfig == "" {
log.Infof("Running postdeploy actions for Nokia SR Linux '%s' node", s.cfg.ShortName)
return addDefaultConfig(ctx, s.runtime, s.cfg)
func (s *srl) PostDeploy(ctx context.Context, _ map[string]nodes.Node) error {
// only perform postdeploy additional config provisioning if there is not startup nor existing config
if s.cfg.StartupConfig != "" || utils.FileExists(s.cfg.LabDir+"/config/config.json") {
return nil
}
return nil

log.Infof("Running postdeploy actions for Nokia SR Linux '%s' node", s.cfg.ShortName)

return addDefaultConfig(ctx, s.runtime, s.cfg)
}

func (s *srl) Destroy(ctx context.Context) error {
func (*srl) Destroy(_ context.Context) error {
// return s.runtime.DeleteContainer(ctx, s.cfg)
return nil
}
Expand All @@ -183,7 +186,7 @@ func (s *srl) GetImages() map[string]string {
}
}

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

Expand Down Expand Up @@ -259,7 +262,7 @@ type mac struct {
MAC string
}

func generateSRLTopologyFile(nodeType, labDir string, index int) error {
func generateSRLTopologyFile(nodeType, labDir string, _ int) error {
dst := filepath.Join(labDir, "topology.yml")

tpl, err := template.ParseFS(topologies, "topology/"+srlTypes[nodeType])
Expand Down
4 changes: 0 additions & 4 deletions utils/networkcli.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"github.com/scrapli/scrapligo/driver/base"
"github.com/scrapli/scrapligo/driver/core"
"github.com/scrapli/scrapligo/driver/network"
"github.com/scrapli/scrapligo/logging"
"github.com/scrapli/scrapligo/transport"
log "github.com/sirupsen/logrus"
"github.com/srl-labs/srlinux-scrapli"
Expand All @@ -26,9 +25,6 @@ func SpawnCLIviaExec(platform, contName string) (*network.Driver, error) {
var d *network.Driver
var err error

// uncomment to enable logging
logging.SetDebugLogger(log.Print)

switch platform {
case "nokia_srlinux":
d, err = srlinux.NewSRLinuxDriver(
Expand Down

0 comments on commit eb11522

Please sign in to comment.