Browse code

Remove dot in suffix to avoid double dot error message

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>

Qiang Huang authored on 2016/03/22 09:53:57
Showing 3 changed files
... ...
@@ -1440,7 +1440,7 @@ func (daemon *Daemon) verifyContainerSettings(hostConfig *containertypes.HostCon
1440 1440
 		if config.WorkingDir != "" {
1441 1441
 			config.WorkingDir = filepath.FromSlash(config.WorkingDir) // Ensure in platform semantics
1442 1442
 			if !system.IsAbs(config.WorkingDir) {
1443
-				return nil, fmt.Errorf("The working directory '%s' is invalid. It needs to be an absolute path.", config.WorkingDir)
1443
+				return nil, fmt.Errorf("The working directory '%s' is invalid. It needs to be an absolute path", config.WorkingDir)
1444 1444
 			}
1445 1445
 		}
1446 1446
 
... ...
@@ -330,10 +330,10 @@ func verifyContainerResources(resources *containertypes.Resources, sysInfo *sysi
330 330
 		resources.MemorySwap = -1
331 331
 	}
332 332
 	if resources.Memory > 0 && resources.MemorySwap > 0 && resources.MemorySwap < resources.Memory {
333
-		return warnings, fmt.Errorf("Minimum memoryswap limit should be larger than memory limit, see usage.")
333
+		return warnings, fmt.Errorf("Minimum memoryswap limit should be larger than memory limit, see usage")
334 334
 	}
335 335
 	if resources.Memory == 0 && resources.MemorySwap > 0 && !update {
336
-		return warnings, fmt.Errorf("You should always set the Memory limit when using Memoryswap limit, see usage.")
336
+		return warnings, fmt.Errorf("You should always set the Memory limit when using Memoryswap limit, see usage")
337 337
 	}
338 338
 	if resources.MemorySwappiness != nil && *resources.MemorySwappiness != -1 && !sysInfo.MemorySwappiness {
339 339
 		warnings = append(warnings, "Your kernel does not support memory swappiness capabilities, memory swappiness discarded.")
... ...
@@ -343,7 +343,7 @@ func verifyContainerResources(resources *containertypes.Resources, sysInfo *sysi
343 343
 	if resources.MemorySwappiness != nil {
344 344
 		swappiness := *resources.MemorySwappiness
345 345
 		if swappiness < -1 || swappiness > 100 {
346
-			return warnings, fmt.Errorf("Invalid value: %v, valid memory swappiness range is 0-100.", swappiness)
346
+			return warnings, fmt.Errorf("Invalid value: %v, valid memory swappiness range is 0-100", swappiness)
347 347
 		}
348 348
 	}
349 349
 	if resources.MemoryReservation > 0 && !sysInfo.MemoryReservation {
... ...
@@ -352,7 +352,7 @@ func verifyContainerResources(resources *containertypes.Resources, sysInfo *sysi
352 352
 		resources.MemoryReservation = 0
353 353
 	}
354 354
 	if resources.Memory > 0 && resources.MemoryReservation > 0 && resources.Memory < resources.MemoryReservation {
355
-		return warnings, fmt.Errorf("Minimum memory limit should be larger than memory reservation limit, see usage.")
355
+		return warnings, fmt.Errorf("Minimum memory limit should be larger than memory reservation limit, see usage")
356 356
 	}
357 357
 	if resources.KernelMemory > 0 && !sysInfo.KernelMemory {
358 358
 		warnings = append(warnings, "Your kernel does not support kernel memory limit capabilities. Limitation discarded.")
... ...
@@ -414,17 +414,17 @@ func verifyContainerResources(resources *containertypes.Resources, sysInfo *sysi
414 414
 	}
415 415
 	cpusAvailable, err := sysInfo.IsCpusetCpusAvailable(resources.CpusetCpus)
416 416
 	if err != nil {
417
-		return warnings, fmt.Errorf("Invalid value %s for cpuset cpus.", resources.CpusetCpus)
417
+		return warnings, fmt.Errorf("Invalid value %s for cpuset cpus", resources.CpusetCpus)
418 418
 	}
419 419
 	if !cpusAvailable {
420
-		return warnings, fmt.Errorf("Requested CPUs are not available - requested %s, available: %s.", resources.CpusetCpus, sysInfo.Cpus)
420
+		return warnings, fmt.Errorf("Requested CPUs are not available - requested %s, available: %s", resources.CpusetCpus, sysInfo.Cpus)
421 421
 	}
422 422
 	memsAvailable, err := sysInfo.IsCpusetMemsAvailable(resources.CpusetMems)
423 423
 	if err != nil {
424
-		return warnings, fmt.Errorf("Invalid value %s for cpuset mems.", resources.CpusetMems)
424
+		return warnings, fmt.Errorf("Invalid value %s for cpuset mems", resources.CpusetMems)
425 425
 	}
426 426
 	if !memsAvailable {
427
-		return warnings, fmt.Errorf("Requested memory nodes are not available - requested %s, available: %s.", resources.CpusetMems, sysInfo.Mems)
427
+		return warnings, fmt.Errorf("Requested memory nodes are not available - requested %s, available: %s", resources.CpusetMems, sysInfo.Mems)
428 428
 	}
429 429
 
430 430
 	// blkio subsystem checks and adjustments
... ...
@@ -434,7 +434,7 @@ func verifyContainerResources(resources *containertypes.Resources, sysInfo *sysi
434 434
 		resources.BlkioWeight = 0
435 435
 	}
436 436
 	if resources.BlkioWeight > 0 && (resources.BlkioWeight < 10 || resources.BlkioWeight > 1000) {
437
-		return warnings, fmt.Errorf("Range of blkio weight is from 10 to 1000.")
437
+		return warnings, fmt.Errorf("Range of blkio weight is from 10 to 1000")
438 438
 	}
439 439
 	if len(resources.BlkioWeightDevice) > 0 && !sysInfo.BlkioWeightDevice {
440 440
 		warnings = append(warnings, "Your kernel does not support Block I/O weight_device.")
... ...
@@ -513,7 +513,7 @@ func verifyPlatformContainerSettings(daemon *Daemon, hostConfig *containertypes.
513 513
 	}
514 514
 
515 515
 	if hostConfig.OomScoreAdj < -1000 || hostConfig.OomScoreAdj > 1000 {
516
-		return warnings, fmt.Errorf("Invalid value %d, range for oom score adj is [-1000, 1000].", hostConfig.OomScoreAdj)
516
+		return warnings, fmt.Errorf("Invalid value %d, range for oom score adj is [-1000, 1000]", hostConfig.OomScoreAdj)
517 517
 	}
518 518
 	if sysInfo.IPv4ForwardingDisabled {
519 519
 		warnings = append(warnings, "IPv4 forwarding is disabled. Networking will not work.")
... ...
@@ -1419,7 +1419,7 @@ func (s *DockerSuite) TestPostContainersCreateWithWrongCpusetValues(c *check.C)
1419 1419
 	status, body, err := sockRequest("POST", "/containers/create?name="+name, c1)
1420 1420
 	c.Assert(err, checker.IsNil)
1421 1421
 	c.Assert(status, checker.Equals, http.StatusInternalServerError)
1422
-	expected := "Invalid value 1-42,, for cpuset cpus.\n"
1422
+	expected := "Invalid value 1-42,, for cpuset cpus\n"
1423 1423
 	c.Assert(string(body), checker.Equals, expected)
1424 1424
 
1425 1425
 	c2 := struct {
... ...
@@ -1430,7 +1430,7 @@ func (s *DockerSuite) TestPostContainersCreateWithWrongCpusetValues(c *check.C)
1430 1430
 	status, body, err = sockRequest("POST", "/containers/create?name="+name, c2)
1431 1431
 	c.Assert(err, checker.IsNil)
1432 1432
 	c.Assert(status, checker.Equals, http.StatusInternalServerError)
1433
-	expected = "Invalid value 42-3,1-- for cpuset mems.\n"
1433
+	expected = "Invalid value 42-3,1-- for cpuset mems\n"
1434 1434
 	c.Assert(string(body), checker.Equals, expected)
1435 1435
 }
1436 1436
 
... ...
@@ -1598,7 +1598,7 @@ func (s *DockerSuite) TestPostContainersCreateWithOomScoreAdjInvalidRange(c *che
1598 1598
 	status, b, err := sockRequest("POST", "/containers/create?name="+name, config)
1599 1599
 	c.Assert(err, check.IsNil)
1600 1600
 	c.Assert(status, check.Equals, http.StatusInternalServerError)
1601
-	expected := "Invalid value 1001, range for oom score adj is [-1000, 1000]."
1601
+	expected := "Invalid value 1001, range for oom score adj is [-1000, 1000]"
1602 1602
 	if !strings.Contains(string(b), expected) {
1603 1603
 		c.Fatalf("Expected output to contain %q, got %q", expected, string(b))
1604 1604
 	}
... ...
@@ -1611,7 +1611,7 @@ func (s *DockerSuite) TestPostContainersCreateWithOomScoreAdjInvalidRange(c *che
1611 1611
 	status, b, err = sockRequest("POST", "/containers/create?name="+name, config)
1612 1612
 	c.Assert(err, check.IsNil)
1613 1613
 	c.Assert(status, check.Equals, http.StatusInternalServerError)
1614
-	expected = "Invalid value -1001, range for oom score adj is [-1000, 1000]."
1614
+	expected = "Invalid value -1001, range for oom score adj is [-1000, 1000]"
1615 1615
 	if !strings.Contains(string(b), expected) {
1616 1616
 		c.Fatalf("Expected output to contain %q, got %q", expected, string(b))
1617 1617
 	}