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

Source Code for Module starcluster.commands.removenode

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