30
30
import iocage .lib .Logger
31
31
32
32
from .shared .click import IocageClickContext
33
+ from .shared .jail import set_properties
33
34
34
35
__rootcmd__ = True
35
36
36
37
37
38
@click .command (name = "start" , help = "Starts the specified jails or ALL." )
38
39
@click .pass_context
39
- @click .option ("--rc" , default = False , is_flag = True ,
40
- help = "Will start all jails with boot=on, in the specified"
41
- " order with smaller value for priority starting first." )
40
+ @click .option (
41
+ "--rc" ,
42
+ default = False ,
43
+ is_flag = True ,
44
+ help = (
45
+ "Will start all jails with boot=on, in the specified "
46
+ "order with smaller value for priority starting first."
47
+ )
48
+ )
49
+ @click .option (
50
+ "--option" , "-o" ,
51
+ "temporary_config_override" ,
52
+ multiple = True ,
53
+ help = "Temporary override jail config options"
54
+ )
42
55
@click .argument ("jails" , nargs = - 1 )
43
56
def cli (
44
57
ctx : IocageClickContext ,
45
58
rc : bool ,
59
+ temporary_config_override : typing .Tuple [str , ...],
46
60
jails : typing .Tuple [str , ...]
47
61
) -> None :
48
62
"""Start one or many jails."""
@@ -64,7 +78,12 @@ def cli(
64
78
exit (1 )
65
79
_autostart (** start_args )
66
80
else :
67
- if not _normal (jails , ** start_args ):
81
+ start_normal_successful = _normal (
82
+ jails ,
83
+ temporary_config_override = temporary_config_override ,
84
+ ** start_args
85
+ )
86
+ if start_normal_successful is False :
68
87
exit (1 )
69
88
70
89
@@ -111,6 +130,7 @@ def _autostart(
111
130
112
131
def _normal (
113
132
filters : typing .Tuple [str , ...],
133
+ temporary_config_override : typing .Tuple [str , ...],
114
134
zfs : iocage .lib .ZFS .ZFS ,
115
135
host : iocage .lib .Host .HostGenerator ,
116
136
logger : iocage .lib .Logger .Logger ,
@@ -132,6 +152,13 @@ def _normal(
132
152
changed_jails = []
133
153
failed_jails = []
134
154
for jail in jails :
155
+ try :
156
+ set_properties (
157
+ properties = temporary_config_override ,
158
+ target = jail
159
+ )
160
+ except iocage .lib .errors .IocageException :
161
+ exit (1 )
135
162
try :
136
163
jail .require_jail_not_template ()
137
164
print_function (jail .start ())
0 commit comments