Skip to content

Commit 31e06db

Browse files
committed
remove Command in favor of Exec_start
1 parent 7c4334f commit 31e06db

File tree

6 files changed

+57
-16
lines changed

6 files changed

+57
-16
lines changed

Parameters.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,12 +295,6 @@ Exec_start
295295
Command(s) to run in the jail environment when a jail is created.
296296
A typical command to run is "sh /etc/rc".
297297
298-
Command
299-
A synonym for exec.start for use when specifying a jail directly
300-
on the command line. Unlike other parameters whose value is a
301-
single string, command uses the remainder of the jail command
302-
line as its own arguments.
303-
304298
Exec_poststart
305299
Command(s) to run in the system environment after a jail is
306300
created, and after any exec.start commands have completed.

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,40 @@ job "test" {
6868
config {
6969
Path = "/zroot/iocage/jails/myjail/root"
7070
Persist = true
71-
Ip4_addr = "192.168.1.102"
7271
}
7372
}
7473
}
7574
}
7675
```
76+
Non vnet jail
77+
-------------
78+
```
79+
job "non-vnet" {
80+
datacenters = ["dc1"]
81+
type = "service"
82+
83+
group "test" {
84+
restart {
85+
attempts = 0
86+
mode = "fail"
87+
}
88+
89+
task "test01" {
90+
driver = "jail-task-driver"
91+
92+
config {
93+
Path = "/zroot/iocage/jails/myjail/root"
94+
Ip4 = "new"
95+
Allow_raw_sockets = true
96+
Allow_chflags = true
97+
Ip4_addr = "em1|192.168.1.102"
98+
Exec_start = "/usr/local/bin/http-echo -listen :9999 -text hello"
99+
}
100+
}
101+
}
102+
}
103+
```
104+
77105
Vnet jail example
78106
-----------------
79107

driver/driver.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ var (
9595
"Exec_created": hclspec.NewAttr("Exec_created", "string", false),
9696
"Exec_start": hclspec.NewAttr("Exec_start", "string", false),
9797
"Exec_stop": hclspec.NewAttr("Exec_stop", "string", false),
98-
"Command": hclspec.NewAttr("Command", "string", false),
9998
"Exec_poststart": hclspec.NewAttr("Exec_poststart", "string", false),
10099
"Exec_poststop": hclspec.NewAttr("Exec_poststop", "string", false),
101100
"Exec_clean": hclspec.NewAttr("Exec_clean", "bool", false),
@@ -181,7 +180,7 @@ type Driver struct {
181180
// Config is the driver configuration set by the SetConfig RPC call
182181
type Config struct {
183182
}
184-
type Rctl struct {
183+
type Rctl struct {
185184
Cputime uint `codec:"Cputime"`
186185
Datasize uint `codec:"Datasize"`
187186
Coredumpsize uint `codec:"Coredumpsize"`
@@ -285,7 +284,6 @@ type TaskConfig struct {
285284
Exec_created string `codec:"Exec_created"`
286285
Exec_start string `codec:"Exec_start"`
287286
Exec_stop string `codec:"Exec_stop"`
288-
Command string `codec:"Command"`
289287
Exec_poststart string `codec:"Exec_postart"`
290288
Exec_poststop string `codec:"Exec_poststop"`
291289
Exec_clean bool `codec:"Exec_clean"`

driver/jail.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import (
1313
hclog "github.com/hashicorp/go-hclog"
1414
"github.com/hashicorp/nomad/plugins/drivers"
1515
"os/exec"
16+
"path/filepath"
1617
"strings"
17-
"path/filepath"
1818
)
1919

2020
func simple_uuid() (string, error) {
@@ -165,8 +165,6 @@ func (d *Driver) initializeContainer(cfg *drivers.TaskConfig, taskConfig TaskCon
165165

166166
if len(taskConfig.Exec_start) > 1 {
167167
jailparams["exec.start"] = taskConfig.Exec_start
168-
} else if len(taskConfig.Command) > 1 {
169-
jailparams["command"] = taskConfig.Command
170168
} else if taskConfig.Persist == true {
171169
jailparams["persist"] = "true"
172170
}

examples/jail-task.nomad

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ job "test" {
1212
driver = "jail-task-driver"
1313

1414
config {
15-
Path = "/zroot/iocage/jails/myjail/root"
16-
Persist = true
17-
Ip4_addr = "192.168.1.102"
15+
Path = "/zroot/iocage/jails/myjail/root"
16+
}
1817
}
1918
}
2019
}

examples/non-vnet.nomad

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
job "test" {
2+
datacenters = ["dc1"]
3+
type = "service"
4+
5+
group "test" {
6+
restart {
7+
attempts = 0
8+
mode = "fail"
9+
}
10+
11+
task "test01" {
12+
driver = "jail-task-driver"
13+
14+
config {
15+
Path = "/zroot/iocage/jails/myjail/root"
16+
Ip4 = "new"
17+
Allow_raw_sockets = true
18+
Allow_chflags = true
19+
Ip4_addr = "em1|192.168.1.102"
20+
Exec_start = "/usr/local/bin/http-echo -listen :9999 -text hello"
21+
}
22+
}
23+
}
24+
}

0 commit comments

Comments
 (0)