Skip to content
This repository has been archived by the owner on Feb 27, 2020. It is now read-only.

Commit

Permalink
refactored script engine as script.script was an ugly config options
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasfj committed Oct 12, 2016
1 parent f9624b3 commit b72e5cc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions engines/script/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package scriptengine
import schematypes "github.com/taskcluster/go-schematypes"

type configType struct {
Script []string `json:"script"`
Command []string `json:"command"`
Expiration int `json:"expiration"`
Schema struct {
Type string `json:"type"`
Expand All @@ -18,9 +18,9 @@ var configSchema = schematypes.Object{
Description: `Configuration properties for the 'scriptengine'.`,
},
Properties: schematypes.Properties{
"script": schematypes.Array{
"command": schematypes.Array{
MetaData: schematypes.MetaData{
Title: "Script to Execute",
Title: "Command to Execute",
Description: `Script and arguments to execute. This script will be fed
a JSON string that matches the schema configured over stdin.`,
},
Expand Down Expand Up @@ -53,7 +53,7 @@ var configSchema = schematypes.Object{
},
},
Required: []string{
"script",
"command",
"schema",
"expiration",
},
Expand Down
2 changes: 1 addition & 1 deletion engines/script/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
var provider = &enginetest.EngineProvider{
Engine: "script",
Config: `{
"script": ["bash", "-ec", "v=$(cat); echo \"$v\"; echo \"$v\" | grep success"],
"command": ["bash", "-ec", "v=$(cat); echo \"$v\"; echo \"$v\" | grep success"],
"schema": {
"type": "object",
"properties": {
Expand Down
2 changes: 1 addition & 1 deletion engines/script/sandboxbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type sandboxBuilder struct {
}

func (b *sandboxBuilder) StartSandbox() (engines.Sandbox, error) {
script := b.engine.config.Script
script := b.engine.config.Command
cmd := exec.Command(script[0], script[1:]...)
folder, err := b.engine.environment.TemporaryStorage.NewFolder()
if err != nil {
Expand Down

0 comments on commit b72e5cc

Please sign in to comment.