From 62a0c5d14c80c912056921430978a9a8a617c0fb Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Wed, 18 Nov 2015 12:30:35 -0800 Subject: [PATCH] Rebase --- client/driver/docker.go | 2 +- client/driver/docker_test.go | 2 +- client/driver/exec_test.go | 4 ++-- client/driver/java.go | 6 +++--- client/driver/java_test.go | 3 +-- client/driver/raw_exec_test.go | 2 +- website/source/docs/drivers/java.html.md | 4 ++-- 7 files changed, 11 insertions(+), 12 deletions(-) diff --git a/client/driver/docker.go b/client/driver/docker.go index a27da8fc4..69aea2b73 100644 --- a/client/driver/docker.go +++ b/client/driver/docker.go @@ -431,7 +431,7 @@ func (d *DockerDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle if len(containers) != 1 { log.Printf("[ERR] driver.docker: failed to get id for container %s", config.Name) - return nil, fmt.Errorf("Failed to get id for container %s: %s", config.Name, err) + return nil, fmt.Errorf("Failed to get id for container %s", config.Name) } log.Printf("[INFO] driver.docker: a container with the name %s already exists; will attempt to purge and re-create", config.Name) diff --git a/client/driver/docker_test.go b/client/driver/docker_test.go index 00ffbe61b..a61de381c 100644 --- a/client/driver/docker_test.go +++ b/client/driver/docker_test.go @@ -192,7 +192,7 @@ func TestDockerDriver_Start_Wait_AllocDir(t *testing.T) { "command": "/bin/bash", "args": []string{ "-c", - fmt.Sprintf(`"sleep 1; echo -n %s > $%s/%s"`, + fmt.Sprintf(`sleep 1; echo -n %s > $%s/%s`, string(exp), environment.AllocDir, file), }, }, diff --git a/client/driver/exec_test.go b/client/driver/exec_test.go index 34b71095b..f5470074a 100644 --- a/client/driver/exec_test.go +++ b/client/driver/exec_test.go @@ -163,7 +163,7 @@ func TestExecDriver_Start_Artifact_expanded(t *testing.T) { "command": "/bin/bash", "args": []string{ "-c", - fmt.Sprintf(`'/bin/sleep 1 && %s'`, filepath.Join("$NOMAD_TASK_DIR", file)), + fmt.Sprintf(`/bin/sleep 1 && %s`, filepath.Join("$NOMAD_TASK_DIR", file)), }, }, Resources: basicResources, @@ -209,7 +209,7 @@ func TestExecDriver_Start_Wait_AllocDir(t *testing.T) { "command": "/bin/bash", "args": []string{ "-c", - fmt.Sprintf(`"sleep 1; echo -n %s > $%s/%s"`, string(exp), environment.AllocDir, file), + fmt.Sprintf(`sleep 1; echo -n %s > $%s/%s`, string(exp), environment.AllocDir, file), }, }, Resources: basicResources, diff --git a/client/driver/java.go b/client/driver/java.go index f408c6087..eb475db32 100644 --- a/client/driver/java.go +++ b/client/driver/java.go @@ -28,7 +28,7 @@ type JavaDriver struct { } type JavaDriverConfig struct { - JvmOpts string `mapstructure:"jvm_options"` + JvmOpts []string `mapstructure:"jvm_options"` ArtifactSource string `mapstructure:"artifact_source"` Checksum string `mapstructure:"checksum"` Args []string `mapstructure:"args"` @@ -126,9 +126,9 @@ func (d *JavaDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle, args := []string{} // Look for jvm options - if driverConfig.JvmOpts != "" { + if len(driverConfig.JvmOpts) != 0 { d.logger.Printf("[DEBUG] driver.java: found JVM options: %s", driverConfig.JvmOpts) - args = append(args, driverConfig.JvmOpts) + args = append(args, driverConfig.JvmOpts...) } // Build the argument list. diff --git a/client/driver/java_test.go b/client/driver/java_test.go index a0c6d3b80..af6e44d6d 100644 --- a/client/driver/java_test.go +++ b/client/driver/java_test.go @@ -51,7 +51,7 @@ func TestJavaDriver_StartOpen_Wait(t *testing.T) { Name: "demo-app", Config: map[string]interface{}{ "artifact_source": "https://dl.dropboxusercontent.com/u/47675/jar_thing/demoapp.jar", - "jvm_options": "-Xmx2048m -Xms256m", + "jvm_options": []string{"-Xmx64m", "-Xms32m"}, "checksum": "sha256:58d6e8130308d32e197c5108edd4f56ddf1417408f743097c2e662df0f0b17c8", }, Resources: basicResources, @@ -97,7 +97,6 @@ func TestJavaDriver_Start_Wait(t *testing.T) { Name: "demo-app", Config: map[string]interface{}{ "artifact_source": "https://dl.dropboxusercontent.com/u/47675/jar_thing/demoapp.jar", - "jvm_options": "-Xmx2048m -Xms256m", "checksum": "sha256:58d6e8130308d32e197c5108edd4f56ddf1417408f743097c2e662df0f0b17c8", }, Resources: basicResources, diff --git a/client/driver/raw_exec_test.go b/client/driver/raw_exec_test.go index 9bf38ad6d..8b6e0c649 100644 --- a/client/driver/raw_exec_test.go +++ b/client/driver/raw_exec_test.go @@ -237,7 +237,7 @@ func TestRawExecDriver_Start_Wait_AllocDir(t *testing.T) { "command": "/bin/bash", "args": []string{ "-c", - fmt.Sprintf(`"sleep 1; echo -n %s > $%s/%s"`, string(exp), environment.AllocDir, file), + fmt.Sprintf(`sleep 1; echo -n %s > $%s/%s`, string(exp), environment.AllocDir, file), }, }, Resources: basicResources, diff --git a/website/source/docs/drivers/java.html.md b/website/source/docs/drivers/java.html.md index 3d74fc751..45baacb72 100644 --- a/website/source/docs/drivers/java.html.md +++ b/website/source/docs/drivers/java.html.md @@ -29,8 +29,8 @@ The `java` driver supports the following configuration in the job spec: * `args` - (Optional) A list of arguments to the `java` command. -* `jvm_options` - (Optional) JVM options to be passed while invoking java. These options - are passed not validated in any way in Nomad. +* `jvm_options` - (Optional) A list of JVM options to be passed while invoking + java. These options are passed not validated in any way in Nomad. ## Client Requirements