From 78a0f82bc55a94e189264f952a06169b3a5dd798 Mon Sep 17 00:00:00 2001 From: Diptanu Choudhury Date: Fri, 13 Nov 2015 20:22:49 -0800 Subject: [PATCH] Making the config for drivers public --- client/driver/docker.go | 8 ++++---- client/driver/exec.go | 4 ++-- client/driver/java.go | 4 ++-- client/driver/qemu.go | 4 ++-- client/driver/raw_exec.go | 2 +- client/driver/rkt.go | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/client/driver/docker.go b/client/driver/docker.go index bd0edf2ac..d07317fad 100644 --- a/client/driver/docker.go +++ b/client/driver/docker.go @@ -24,7 +24,7 @@ type DockerDriver struct { fingerprint.StaticFingerprinter } -type dockerDriverConfig struct { +type DockerDriverConfig struct { ImageName string `mapstructure:"image"` Command string `mapstructure:"command"` Args string `mapstructure:"args"` @@ -39,7 +39,7 @@ type dockerDriverConfig struct { SearchDomains string `mapstructure:"search_domains"` } -func (c *dockerDriverConfig) Validate() error { +func (c *DockerDriverConfig) Validate() error { if c.ImageName == "" { return fmt.Errorf("Docker Driver needs an image name") } @@ -139,7 +139,7 @@ func (d *DockerDriver) containerBinds(alloc *allocdir.AllocDir, task *structs.Ta } // createContainer initializes a struct needed to call docker.client.CreateContainer() -func (d *DockerDriver) createContainer(ctx *ExecContext, task *structs.Task, driverConfig *dockerDriverConfig) (docker.CreateContainerOptions, error) { +func (d *DockerDriver) createContainer(ctx *ExecContext, task *structs.Task, driverConfig *DockerDriverConfig) (docker.CreateContainerOptions, error) { var c docker.CreateContainerOptions if task.Resources == nil { d.logger.Printf("[ERR] driver.docker: task.Resources is empty") @@ -320,7 +320,7 @@ func (d *DockerDriver) createContainer(ctx *ExecContext, task *structs.Task, dri } func (d *DockerDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle, error) { - var driverConfig dockerDriverConfig + var driverConfig DockerDriverConfig if err := mapstructure.WeakDecode(task.Config, &driverConfig); err != nil { return nil, err } diff --git a/client/driver/exec.go b/client/driver/exec.go index 11eff80ae..bcde063ed 100644 --- a/client/driver/exec.go +++ b/client/driver/exec.go @@ -22,7 +22,7 @@ type ExecDriver struct { DriverContext fingerprint.StaticFingerprinter } -type execDriverConfig struct { +type ExecDriverConfig struct { ArtifactSource string `mapstructure:"artifact_source` Checksum string `mapstructure:"checksum"` Command string `mapstructure:"command"` @@ -56,7 +56,7 @@ func (d *ExecDriver) Fingerprint(cfg *config.Config, node *structs.Node) (bool, } func (d *ExecDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle, error) { - var driverConfig execDriverConfig + var driverConfig ExecDriverConfig if err := mapstructure.WeakDecode(task.Config, &driverConfig); err != nil { return nil, err } diff --git a/client/driver/java.go b/client/driver/java.go index b87fdac79..774d7524a 100644 --- a/client/driver/java.go +++ b/client/driver/java.go @@ -26,7 +26,7 @@ type JavaDriver struct { fingerprint.StaticFingerprinter } -type javaDriverConfig struct { +type JavaDriverConfig struct { JvmOpts string `mapstructure:"jvm_options"` ArtifactSource string `mapstructure:"artifact_source` Checksum string `mapstructure:"checksum"` @@ -98,7 +98,7 @@ func (d *JavaDriver) Fingerprint(cfg *config.Config, node *structs.Node) (bool, } func (d *JavaDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle, error) { - var driverConfig javaDriverConfig + var driverConfig JavaDriverConfig if err := mapstructure.WeakDecode(task.Config, &driverConfig); err != nil { return nil, err } diff --git a/client/driver/qemu.go b/client/driver/qemu.go index 23d3f4777..e12387e98 100644 --- a/client/driver/qemu.go +++ b/client/driver/qemu.go @@ -31,7 +31,7 @@ type QemuDriver struct { fingerprint.StaticFingerprinter } -type qemuDriverConfig struct { +type QemuDriverConfig struct { ArtifactSource string `mapstructure:"artifact_source` Checksum string `mapstructure:"checksum"` Accelerator string `mapstructure:"accelerator"` @@ -77,7 +77,7 @@ func (d *QemuDriver) Fingerprint(cfg *config.Config, node *structs.Node) (bool, // Run an existing Qemu image. Start() will pull down an existing, valid Qemu // image and save it to the Drivers Allocation Dir func (d *QemuDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle, error) { - var driverConfig qemuDriverConfig + var driverConfig QemuDriverConfig if err := mapstructure.WeakDecode(task.Config, &driverConfig); err != nil { return nil, err } diff --git a/client/driver/raw_exec.go b/client/driver/raw_exec.go index 64c130378..f0bb1113c 100644 --- a/client/driver/raw_exec.go +++ b/client/driver/raw_exec.go @@ -57,7 +57,7 @@ func (d *RawExecDriver) Fingerprint(cfg *config.Config, node *structs.Node) (boo } func (d *RawExecDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle, error) { - var driverConfig execDriverConfig + var driverConfig ExecDriverConfig if err := mapstructure.WeakDecode(task.Config, &driverConfig); err != nil { return nil, err } diff --git a/client/driver/rkt.go b/client/driver/rkt.go index 0911b12a7..045b981b6 100644 --- a/client/driver/rkt.go +++ b/client/driver/rkt.go @@ -35,7 +35,7 @@ type RktDriver struct { fingerprint.StaticFingerprinter } -type rktDriverConfig struct { +type RktDriverConfig struct { ImageName string `mapstructure:"image"` Args string `mapstructure:"args"` } @@ -89,7 +89,7 @@ func (d *RktDriver) Fingerprint(cfg *config.Config, node *structs.Node) (bool, e // Run an existing Rkt image. func (d *RktDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle, error) { - var driverConfig rktDriverConfig + var driverConfig RktDriverConfig if err := mapstructure.WeakDecode(task.Config, &driverConfig); err != nil { return nil, err }