#NEWLINE# def register_instances( name , instances , region = None , key = None , keyid = None , profile = None ) : #NEWLINE# #INDENT# '\n    Register instances with an ELB.  Instances is either a string\n    instance id or a list of string instance id\'s.\n\n    Returns:\n\n    - ``True``: instance(s) registered successfully\n    - ``False``: instance(s) failed to be registered\n\n    CLI example:\n\n    .. code-block:: bash\n\n        salt myminion boto_elb.register_instances myelb instance_id\n        salt myminion boto_elb.register_instances myelb "[instance_id,instance_id]"\n    ' #NEWLINE# if ( isinstance ( instances , str ) or isinstance ( name , six . text_type ) ) : #NEWLINE# #INDENT# instances = [ instances ] #NEWLINE# #UNINDENT# conn = _get_conn ( region = region , key = key , keyid = keyid , profile = profile ) #NEWLINE# try : #NEWLINE# #INDENT# registered_instances = conn . register_instances ( name , instances ) #NEWLINE# #UNINDENT# except boto . exception . BotoServerError as error : #NEWLINE# #INDENT# log . warning ( error ) #NEWLINE# return False #NEWLINE# #UNINDENT# registered_instance_ids = [ instance . id for instance in registered_instances ] #NEWLINE# register_failures = set ( instances ) . difference ( set ( registered_instance_ids ) ) #NEWLINE# if register_failures : #NEWLINE# #INDENT# log . warning ( 'Instance(s): {0} not registered with ELB {1}.' . format ( list ( register_failures ) , name ) ) #NEWLINE# register_result = False #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# register_result = True #NEWLINE# #UNINDENT# return register_result