17
17
18
18
from starcluster import static
19
19
from completers import ClusterCompleter
20
+ from starcluster import completion
20
21
21
22
22
23
class CmdAddNode (ClusterCompleter ):
@@ -70,6 +71,9 @@ class CmdAddNode(ClusterCompleter):
70
71
tag = None
71
72
72
73
def addopts (self , parser ):
74
+ templates = []
75
+ if self .cfg :
76
+ templates = self .cfg .clusters .keys ()
73
77
parser .add_option (
74
78
"-a" , "--alias" , dest = "alias" , action = "append" , type = "string" ,
75
79
default = [], help = "alias to give to the new node "
@@ -97,6 +101,15 @@ def addopts(self, parser):
97
101
"-x" , "--no-create" , dest = "no_create" , action = "store_true" ,
98
102
default = False , help = "do not launch new EC2 instances when "
99
103
"adding nodes (use existing instances instead)" )
104
+ parser .add_option (
105
+ "--reload-plugins" , dest = "reload_plugins" , action = "store_true" ,
106
+ default = False , help = "reload_plugins from config" )
107
+ opt = parser .add_option ("-c" , "--cluster-template" , action = "store" ,
108
+ dest = "cluster_template" , choices = templates ,
109
+ default = None , help = "cluster template to use "
110
+ "from the config file" )
111
+ if completion :
112
+ opt .completer = completion .ListCompleter (opt .choices )
100
113
101
114
def execute (self , args ):
102
115
if len (args ) != 1 :
@@ -121,8 +134,14 @@ def execute(self, args):
121
134
if not self .opts .alias and self .opts .no_create :
122
135
self .parser .error ("you must specify one or more node aliases via "
123
136
"the -a option when using -x" )
137
+ if self .opts .reload_plugins :
138
+ template = self .opts .cluster_template or self .cm .get_default_cluster_template ()
139
+ plugins = self .cm .get_cluster_template (template , tag ).plugins
140
+ else :
141
+ plugins = None
142
+
124
143
self .cm .add_nodes (tag , num_nodes , aliases = aliases ,
125
144
image_id = self .opts .image_id ,
126
145
instance_type = self .opts .instance_type ,
127
146
zone = self .opts .zone , spot_bid = self .opts .spot_bid ,
128
- no_create = self .opts .no_create )
147
+ no_create = self .opts .no_create , plugins = plugins )
0 commit comments