Package starcluster :: Package commands :: Module removenode
[hide private]
[frames] | no frames]

Source Code for Module starcluster.commands.removenode

 1  from completers import ClusterCompleter 
 2   
 3   
4 -class CmdRemoveNode(ClusterCompleter):
5 """ 6 removenode [options] <cluster_tag> <node> [<node> ...] 7 8 Terminate one or more nodes in the cluster 9 10 Examples: 11 12 $ starcluster removenode mycluster node003 13 14 This will remove node003 from mycluster and terminate the node. 15 16 You can also specify multiple nodes to remove and terminate one after 17 another: 18 19 $ starcluster removenode mycluster node001 node002 node003 20 21 If you'd rather not terminate the node(s) after removing from the cluster, 22 use the -k option: 23 24 $ starcluster removenode -k mycluster node001 node002 node003 25 26 This will remove the nodes from the cluster but leave the instances 27 running. This can be useful, for example, when testing on_add_node methods 28 in a StarCluster plugin. 29 """ 30 names = ['removenode', 'rn'] 31 32 tag = None 33
34 - def addopts(self, parser):
35 parser.add_option("-k", "--keep-instance", dest="terminate", 36 action="store_false", default=True, 37 help="do not terminate instances " 38 "after removing nodes")
39
40 - def execute(self, args):
41 if not len(args) >= 2: 42 self.parser.error("please specify a <cluster_tag> and <node>") 43 tag = self.tag = args[0] 44 aliases = args[1:] 45 for alias in aliases: 46 self.cm.remove_node(tag, alias, terminate=self.opts.terminate)
47