Revert "Revert "Make drivers take arguments as a list and not as a string""

This commit is contained in:
Alex Dadgar
2015-11-18 15:16:42 -08:00
parent 0003310aa6
commit 7357979089
29 changed files with 149 additions and 205 deletions

View File

@@ -28,10 +28,10 @@ type JavaDriver struct {
}
type JavaDriverConfig struct {
JvmOpts string `mapstructure:"jvm_options"`
ArtifactSource string `mapstructure:"artifact_source"`
Checksum string `mapstructure:"checksum"`
Args string `mapstructure:"args"`
JvmOpts []string `mapstructure:"jvm_options"`
ArtifactSource string `mapstructure:"artifact_source"`
Checksum string `mapstructure:"checksum"`
Args []string `mapstructure:"args"`
}
// javaHandle is returned from Start/Open as a handle to the PID
@@ -126,15 +126,15 @@ 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.
args = append(args, "-jar", filepath.Join(allocdir.TaskLocal, jarName))
if driverConfig.Args != "" {
args = append(args, driverConfig.Args)
if len(driverConfig.Args) != 0 {
args = append(args, driverConfig.Args...)
}
// Setup the command