Home | Trees | Indices | Help |
|
---|
|
1 #!/usr/bin/env python 2 3 from starcluster import config 4 from starcluster import optcomplete 5 from starcluster.logger import log 6 7 from base import CmdBase 2427 """ 28 Returns a list of all cluster names as completion options 29 """3931 try: 32 cm = self.cm 33 clusters = cm.get_cluster_security_groups() 34 completion_list = [cm.get_tag_from_sg(sg.name) \ 35 for sg in clusters] 36 return optcomplete.ListCompleter(completion_list) 37 except Exception, e: 38 log.error('something went wrong fix me: %s' % e)42 """ 43 Returns a list of all node names as completion options 44 """6346 try: 47 cm = self.cm 48 clusters = cm.get_cluster_security_groups() 49 compl_list = [cm.get_tag_from_sg(sg.name) for sg in clusters] 50 max_num_nodes = 0 51 for scluster in clusters: 52 num_instances = len(scluster.instances()) 53 if num_instances > max_num_nodes: 54 max_num_nodes = num_instances 55 compl_list.extend(['master']) 56 compl_list.extend([str(i) for i in range(0, num_instances)]) 57 compl_list.extend(["node%03d" % i \ 58 for i in range(1, num_instances)]) 59 return optcomplete.ListCompleter(compl_list) 60 except Exception, e: 61 print e 62 log.error('something went wrong fix me: %s' % e)66 """ 67 Returns a list of all registered image ids as completion options 68 """7670 try: 71 rimages = self.ec2.registered_images 72 completion_list = [i.id for i in rimages] 73 return optcomplete.ListCompleter(completion_list) 74 except Exception, e: 75 log.error('something went wrong fix me: %s' % e)79 """ 80 Returns a list of all registered EBS image ids as completion options 81 """9083 try: 84 rimages = self.ec2.registered_images 85 completion_list = [i.id for i in rimages if 86 i.root_device_type == "ebs"] 87 return optcomplete.ListCompleter(completion_list) 88 except Exception, e: 89 log.error('something went wrong fix me: %s' % e)93 """ 94 Returns a list of all registered S3 image ids as completion options 95 """10497 try: 98 rimages = self.ec2.registered_images 99 completion_list = [i.id for i in rimages if 100 i.root_device_type == "instance-store"] 101 return optcomplete.ListCompleter(completion_list) 102 except Exception, e: 103 log.error('something went wrong fix me: %s' % e)107 """ 108 Returns a list of all instance ids as completion options 109 """ 110 show_dns_names = False 111121113 try: 114 instances = self.ec2.get_all_instances() 115 completion_list = [i.id for i in instances] 116 if self.show_dns_names: 117 completion_list.extend([i.dns_name for i in instances]) 118 return optcomplete.ListCompleter(completion_list) 119 except Exception, e: 120 log.error('something went wrong fix me: %s' % e)124 """ 125 Returns a list of all volume ids as completion options 126 """133128 try: 129 completion_list = [v.id for v in self.ec2.get_volumes()] 130 return optcomplete.ListCompleter(completion_list) 131 except Exception, e: 132 log.error('something went wrong fix me: %s' % e)
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Mon Oct 17 13:43:37 2011 | http://epydoc.sourceforge.net |