def do_roles(self, service):
        """
        Role information
        Usage:
            > roles <servicename>   Display role information for service
            > roles all             Display all role information for cluster
        """
        if not self.has_cluster():
            return None

        if not service:
            return None

        if service == "all":
            if not self.CACHED_SERVICES:
                self.services_autocomplete('', service, 0, 0)

            for s in self.CACHED_SERVICES:
                print("= " + s.upper() + " =")
                self.do_roles(s)
            return None
        try:
            service = api.get_cluster(self.cluster).get_service(service)
            headers = ["ROLE TYPE", "HOST", "ROLE NAME", "STATE", "HEALTH", "CONFIG"]
            align = ["ROLE TYPE", "ROLE NAME", "HOST"]
            rows = []
            for roletype in service.get_role_types():
                for role in service.get_roles_by_type(roletype):
                    if role.configStale:
                        config = "STALE"
                    else:
                        config = "UP TO DATE"
                    rows.append([role.type, role.hostRef.hostId, role.name, role.roleState, role.healthSummary, config])
            self.generate_output(headers, rows, align=align)
        except ApiException:
            print("Service not found")
def do_roles ( self , service ) : if not self . has_cluster ( ) : return None if not service : return None if service == "all" : if not self . CACHED_SERVICES : self . services_autocomplete ( '' , service , 0 , 0 ) for s in self . CACHED_SERVICES : print ( "= " + s . upper ( ) + " =" ) self . do_roles ( s ) return None try : service = api . get_cluster ( self . cluster ) . get_service ( service ) headers = [ "ROLE TYPE" , "HOST" , "ROLE NAME" , "STATE" , "HEALTH" , "CONFIG" ] align = [ "ROLE TYPE" , "ROLE NAME" , "HOST" ] rows = [ ] for roletype in service . get_role_types ( ) : for role in service . get_roles_by_type ( roletype ) : if role . configStale : config = "STALE" else : config = "UP TO DATE" rows . append ( [ role . type , role . hostRef . hostId , role . name , role . roleState , role . healthSummary , config ] ) self . generate_output ( headers , rows , align = align ) except ApiException : print ( "Service not found" )
Role information
        Usage:
            > roles <servicename>   Display role information for service
            > roles all             Display all role information for cluster