Merge pull request #2904 from SvenDowideit/dont-show-user-internal-slash-in-error-message

there appears to be a slash prepended to a container name internally
This commit is contained in:
Guillaume J. Charmes 2013-11-27 09:58:24 -08:00
commit f75dc36204
1 changed files with 2 additions and 1 deletions

View File

@ -422,7 +422,8 @@ func (runtime *Runtime) Create(config *Config, name string) (*Container, []strin
if _, err := runtime.containerGraph.Set(name, id); err != nil {
if strings.HasSuffix(err.Error(), "name are not unique") {
conflictingContainer, _ := runtime.GetByName(name)
return nil, nil, fmt.Errorf("Conflict, The name %s is already assigned to %s. You have to delete (or rename) that container to be able to assign %s to a container again.", name, utils.TruncateID(conflictingContainer.ID), name)
nameAsKnownByUser := strings.TrimPrefix(name, "/")
return nil, nil, fmt.Errorf("Conflict, The name %s is already assigned to %s. You have to delete (or rename) that container to be able to assign %s to a container again.", nameAsKnownByUser, utils.TruncateID(conflictingContainer.ID), nameAsKnownByUser)
}
return nil, nil, err
}