mirror of
				https://github.com/moby/moby.git
				synced 2022-11-09 12:21:53 -05:00 
			
		
		
		
	Remove redundant error message
Currently some commands including `kill`, `pause`, `restart`, `rm`, `rmi`, `stop`, `unpause`, `udpate`, `wait` will print a lot of error message on client side, with a lot of redundant messages, this commit is trying to remove the unuseful and redundant information for user. Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
This commit is contained in:
		
							parent
							
								
									6f88a3d7d3
								
							
						
					
					
						commit
						894266c1bb
					
				
					 17 changed files with 58 additions and 32 deletions
				
			
		| 
						 | 
				
			
			@ -3,6 +3,7 @@ package daemon
 | 
			
		|||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
 | 
			
		||||
	derr "github.com/docker/docker/errors"
 | 
			
		||||
	"github.com/docker/engine-api/types/container"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -44,15 +45,17 @@ func (daemon *Daemon) update(name string, hostConfig *container.HostConfig) erro
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	if container.RemovalInProgress || container.Dead {
 | 
			
		||||
		return fmt.Errorf("Container is marked for removal and cannot be \"update\".")
 | 
			
		||||
		errMsg := fmt.Errorf("Container is marked for removal and cannot be \"update\".")
 | 
			
		||||
		return derr.ErrorCodeCantUpdate.WithArgs(container.ID, errMsg)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if container.IsRunning() && hostConfig.KernelMemory != 0 {
 | 
			
		||||
		return fmt.Errorf("Can not update kernel memory to a running container, please stop it first.")
 | 
			
		||||
		errMsg := fmt.Errorf("Can not update kernel memory to a running container, please stop it first.")
 | 
			
		||||
		return derr.ErrorCodeCantUpdate.WithArgs(container.ID, errMsg)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if err := container.UpdateContainer(hostConfig); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
		return derr.ErrorCodeCantUpdate.WithArgs(container.ID, err.Error())
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// If container is not running, update hostConfig struct is enough,
 | 
			
		||||
| 
						 | 
				
			
			@ -61,7 +64,7 @@ func (daemon *Daemon) update(name string, hostConfig *container.HostConfig) erro
 | 
			
		|||
	// to the real world.
 | 
			
		||||
	if container.IsRunning() {
 | 
			
		||||
		if err := daemon.execDriver.Update(container.Command); err != nil {
 | 
			
		||||
			return err
 | 
			
		||||
			return derr.ErrorCodeCantUpdate.WithArgs(container.ID, err.Error())
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue