#NEWLINE# def attach_lb( kwargs = None , call = None ) : #NEWLINE# #INDENT# '\n    Add an existing node/member to an existing load-balancer configuration.\n\n    CLI Example:\n\n    .. code-block:: bash\n\n        salt-cloud -f attach_lb gce name=lb member=myinstance\n    ' #NEWLINE# if ( call != 'function' ) : #NEWLINE# #INDENT# raise SaltCloudSystemExit ( 'The attach_lb function must be called with -f or --function.' ) #NEWLINE# #UNINDENT# if ( ( not kwargs ) or ( 'name' not in kwargs ) ) : #NEWLINE# #INDENT# log . error ( 'A load-balancer name must be specified.' ) #NEWLINE# return False #NEWLINE# #UNINDENT# if ( 'member' not in kwargs ) : #NEWLINE# #INDENT# log . error ( 'A node name name must be specified.' ) #NEWLINE# return False #NEWLINE# #UNINDENT# conn = get_conn ( ) #NEWLINE# node = conn . ex_get_node ( kwargs [ 'member' ] ) #NEWLINE# lb_conn = get_lb_conn ( conn ) #NEWLINE# lb = lb_conn . get_balancer ( kwargs [ 'name' ] ) #NEWLINE# salt . utils . cloud . fire_event ( 'event' , 'attach load_balancer' , 'salt/cloud/loadbalancer/attaching' , lb , transport = __opts__ [ 'transport' ] ) #NEWLINE# result = lb_conn . balancer_attach_compute_node ( lb , node ) #NEWLINE# salt . utils . cloud . fire_event ( 'event' , 'attached load_balancer' , 'salt/cloud/loadbalancer/attached' , kwargs , transport = __opts__ [ 'transport' ] ) #NEWLINE# return _expand_item ( result )