Skip to content

Commit

Permalink
Add more descriptive errors
Browse files Browse the repository at this point in the history
  • Loading branch information
LimeHat committed Feb 17, 2022
1 parent 8a9aea4 commit bd06b5d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions runtime/podman/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,15 @@ func (r *PodmanRuntime) createContainerSpec(ctx context.Context, cfg *types.Node
case "container":
// We expect exactly two arguments in this case ("container" keyword & cont. name/ID)
if len(netns) != 2 {
return sg, fmt.Errorf("container network mode was specified, but no container name was found: %q", netns)
return sg, fmt.Errorf("container network mode was specified for container %q, but no container name was found: %q", cfg.ShortName, netns)
}
// also cont. ID shouldn't be empty
if netns[1] == "" {
return sg, fmt.Errorf("container network mode was specified, but no container name was found: %q", netns)
return sg, fmt.Errorf("container network mode was specified for container %q, but no container name was found: %q", cfg.ShortName, netns)
}
// Extract lab/topo prefix to provide a full (long) container name. Hackish way.
prefix := strings.SplitN(cfg.LongName, cfg.ShortName, 2)[0]
// Compile the net spec
specNetConfig = specgen.ContainerNetworkConfig{
NetNS: specgen.Namespace{
NSMode: "container",
Expand Down

0 comments on commit bd06b5d

Please sign in to comment.