cleanup code comments and small fixes from refactor

This commit is contained in:
Nick Ethier 2019-01-15 17:07:21 -05:00
parent f626b6bf3d
commit 30b9c95427
No known key found for this signature in database
GPG key ID: 07C1A3ECED90D24A
5 changed files with 14 additions and 9 deletions

View file

@ -86,10 +86,8 @@ func (t *taskRunnerState08) Upgrade(allocID, taskName string) *state.LocalState
PrestartDone: t.PayloadRendered, PrestartDone: t.PayloadRendered,
} }
//TODO How to convert handles?! This does not work. // Add nessicary fields to TaskConfig
ls.TaskHandle = drivers.NewTaskHandle(0) ls.TaskHandle = drivers.NewTaskHandle(0)
//TODO where do we get this from?
ls.TaskHandle.Config = &drivers.TaskConfig{ ls.TaskHandle.Config = &drivers.TaskConfig{
Name: taskName, Name: taskName,
AllocID: allocID, AllocID: allocID,

View file

@ -162,7 +162,7 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive
return nil, nil, fmt.Errorf("failed to decode driver config: %v", err) return nil, nil, fmt.Errorf("failed to decode driver config: %v", err)
} }
handle := drivers.NewTaskHandle(pluginName) handle := drivers.NewTaskHandle(1)
handle.Config = cfg handle.Config = cfg
// Initialize docker API clients // Initialize docker API clients

View file

@ -25,6 +25,7 @@ const (
var ( var (
// Handshake is a common handshake that is shared by all plugins and Nomad. // Handshake is a common handshake that is shared by all plugins and Nomad.
Handshake = plugin.HandshakeConfig{ Handshake = plugin.HandshakeConfig{
ProtocolVersion: 2,
MagicCookieKey: "NOMAD_PLUGIN_MAGIC_COOKIE", MagicCookieKey: "NOMAD_PLUGIN_MAGIC_COOKIE",
MagicCookieValue: "e4327c2e01eabfd75a8a67adb114fb34a757d57eee7728d857a8cec6e91a7255", MagicCookieValue: "e4327c2e01eabfd75a8a67adb114fb34a757d57eee7728d857a8cec6e91a7255",
} }

View file

@ -1,16 +1,20 @@
package catalog package catalog
import ( import (
"github.com/hashicorp/nomad/drivers/docker"
"github.com/hashicorp/nomad/drivers/exec" "github.com/hashicorp/nomad/drivers/exec"
"github.com/hashicorp/nomad/drivers/java"
"github.com/hashicorp/nomad/drivers/qemu"
"github.com/hashicorp/nomad/drivers/rawexec"
) )
// This file is where all builtin plugins should be registered in the catalog. // This file is where all builtin plugins should be registered in the catalog.
// Plugins with build restrictions should be placed in the appropriate // Plugins with build restrictions should be placed in the appropriate
// register_XXX.go file. // register_XXX.go file.
func init() { func init() {
// RegisterDeferredConfig(rawexec.PluginID, rawexec.PluginConfig, rawexec.PluginLoader) RegisterDeferredConfig(rawexec.PluginID, rawexec.PluginConfig, rawexec.PluginLoader)
Register(exec.PluginID, exec.PluginConfig) Register(exec.PluginID, exec.PluginConfig)
// Register(qemu.PluginID, qemu.PluginConfig) Register(qemu.PluginID, qemu.PluginConfig)
// Register(java.PluginID, java.PluginConfig) Register(java.PluginID, java.PluginConfig)
// RegisterDeferredConfig(docker.PluginID, docker.PluginConfig, docker.PluginLoader) RegisterDeferredConfig(docker.PluginID, docker.PluginConfig, docker.PluginLoader)
} }

View file

@ -1,8 +1,10 @@
package catalog package catalog
import "github.com/hashicorp/nomad/drivers/rkt"
// This file is where all builtin plugins should be registered in the catalog. // This file is where all builtin plugins should be registered in the catalog.
// Plugins with build restrictions should be placed in the appropriate // Plugins with build restrictions should be placed in the appropriate
// register_XXX.go file. // register_XXX.go file.
func init() { func init() {
// RegisterDeferredConfig(rkt.PluginID, rkt.PluginConfig, rkt.PluginLoader) RegisterDeferredConfig(rkt.PluginID, rkt.PluginConfig, rkt.PluginLoader)
} }