Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions pkg/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -542,16 +542,16 @@ func enforceBroadcomState(ctx context.Context, processor dozer.Processor, agent
return nil
}

func enforceCelesticaState(_ context.Context, _ /* processor */ dozer.Processor, agent *agentapi.Agent, _ /* basedir */ string, dryRun bool) error {
func enforceCelesticaState(ctx context.Context, _ /* processor */ dozer.Processor, agent *agentapi.Agent, _ /* basedir */ string, dryRun bool) error {
if dryRun {
slog.Warn("Dry run, exiting")

return nil
}

// temp hack to patch shadow file for admin user on Celestica SONiC+ to avoid prompt for changing password
slog.Info("Celestica SONiC+ configuration not supported, just enforcing admin password")
slog.Info("Celestica SONiC+ configuration not supported, just enforcing admin password and turning off ZTP")

// temp hack to patch shadow file for admin user on Celestica SONiC+ to avoid prompt for changing password
for _, user := range agent.Spec.Users {
name := user.Name

Expand All @@ -564,6 +564,17 @@ func enforceCelesticaState(_ context.Context, _ /* processor */ dozer.Processor,
}
}

ctx, cancel := context.WithTimeout(ctx, 5*time.Minute)
defer cancel()

cmd := exec.CommandContext(ctx, "sudo", "ztp", "disable", "--yes")
cmd.Stdout = logutil.NewSink(ctx, slog.Debug, "ztp-disable: ")
cmd.Stderr = logutil.NewSink(ctx, slog.Debug, "ztp-disable: ")
Comment on lines +567 to +572

if err := cmd.Run(); err != nil {
return fmt.Errorf("ztp-disable: %w", err)
}
Comment on lines +574 to +576

return nil
}

Expand Down
Loading