def list_servers_command(parsed_options): servers = repository.lookup_all_servers() if not servers or len(servers) < 1: log_info("No servers have been configured.") return servers = sorted(servers, key=lambda s: s.id) bar = "-" * 80 print bar formatter = "%-25s %-40s %s" print formatter % ("_ID", "DESCRIPTION", "CONNECT TO") print bar for server in servers: print formatter % (server.id, to_string(server.get_description()), to_string(server.get_address_display())) print "\n"
def list_servers_command(parsed_options): servers = repository.lookup_all_servers() if not servers or len(servers) < 1: log_info("No servers have been configured.") return servers = sorted(servers, key=lambda s: s.id) bar = "-" * 80 print bar formatter = "%-25s %-40s %s" print formatter % ("_ID", "DESCRIPTION", "CONNECT TO") print bar for server in servers: print formatter % (server.id, to_string( server.get_description()), to_string(server.get_address_display())) print "\n"
def list_clusters_command(parsed_options): clusters = repository.lookup_all_clusters() if not clusters or len(clusters) < 1: log_info("No clusters configured") return # sort clusters by id clusters = sorted(clusters, key=lambda c: c.id) bar = "-" * 80 print bar formatter = "%-25s %-40s %s" print formatter % ("_ID", "DESCRIPTION", "MEMBERS") print bar for cluster in clusters: desc = to_string(cluster.get_description()) members_info = "[ %s ]" % ", ".join(cluster.get_members_info()) print formatter % (cluster.id, desc, members_info) print "\n"
def list_clusters_command(parsed_options): clusters = repository.lookup_all_clusters() if not clusters or len(clusters) < 1: log_info("No clusters configured") return # sort clusters by id clusters = sorted(clusters, key=lambda c: c.id) bar = "-"*80 print bar formatter = "%-25s %-40s %s" print formatter % ("_ID", "DESCRIPTION", "MEMBERS") print bar for cluster in clusters: desc = to_string(cluster.get_description()) members_info = "[ %s ]" % ", ".join(cluster.get_members_info) print formatter % (cluster.id, desc, members_info) print "\n"