Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix passing empty string container name to unit params; #12890

Merged
merged 3 commits into from
Apr 19, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 4 additions & 3 deletions cmd/containeragent/unit/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ type containerUnitAgent struct {
clk clock.Clock
runner *worker.Runner
bufferedLogger *logsender.BufferedLogWriter
setupLogging func(agent.Config) error
ctx *cmd.Context
dead chan struct{}
errReason error
Expand Down Expand Up @@ -187,8 +186,10 @@ func (c *containerUnitAgent) Init(args []string) error {
if err := c.ensureToolSymlinks(srcDir, dataDir, unitTag); err != nil {
return errors.Annotate(err, "ensuring agent tool symlinks")
}

c.containerNames = strings.Split(c.environment.Getenv("JUJU_CONTAINER_NAMES"), ",")
containerNames := c.environment.Getenv("JUJU_CONTAINER_NAMES")
ycliuhw marked this conversation as resolved.
Show resolved Hide resolved
if len(containerNames) > 0 {
c.containerNames = strings.Split(containerNames, ",")
}
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion worker/uniter/pebblepoller.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (p *pebblePoller) run(containerName string) error {
timer.Reset(pebblePollInterval)
err := p.poll(containerName)
if err != nil && err != tomb.ErrDying {
p.logger.Errorf("pebble poll failed: %v", err)
p.logger.Errorf("pebble poll failed for container %q: %v", containerName, err)
}
}
}
Expand Down