From bfbad06c13ff56ed988d66d8c8241cf406859e9e Mon Sep 17 00:00:00 2001 From: HuKeping Date: Thu, 8 Jan 2015 17:15:55 +0800 Subject: [PATCH] log: Add restart policy name to the inspect information of container Under the restart policy "--restart=no", there is no record about it in the information from docker inspect. To keep it consistent around the three(maybe more in the future) restart policies and distinguish with no restart policy specified cases, it's worth to record it even though it is the default restart policy which will not restart the container. Signed-off-by: Hu Keping Upstream-commit: 2082ff82b581dfbe252338829c1ce7c31797f66c Component: engine --- components/engine/runconfig/parse.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/components/engine/runconfig/parse.go b/components/engine/runconfig/parse.go index 3502270b20..20510660fe 100644 --- a/components/engine/runconfig/parse.go +++ b/components/engine/runconfig/parse.go @@ -336,18 +336,15 @@ func parseRestartPolicy(policy string) (RestartPolicy, error) { name = parts[0] ) + p.Name = name switch name { case "always": - p.Name = name - if len(parts) == 2 { return p, fmt.Errorf("maximum restart count not valid with restart policy of \"always\"") } case "no": // do nothing case "on-failure": - p.Name = name - if len(parts) == 2 { count, err := strconv.Atoi(parts[1]) if err != nil {