#NEWLINE# def _case_group( ret , users , group_name , existing_users , region , key , keyid , profile ) : #NEWLINE# #INDENT# _users = [ ] #NEWLINE# for user in existing_users : #NEWLINE# #INDENT# _users . append ( user [ 'user_name' ] ) #NEWLINE# #UNINDENT# log . debug ( 'upstream users are {0}' . format ( _users ) ) #NEWLINE# for user in users : #NEWLINE# #INDENT# log . debug ( 'users are {0}' . format ( user ) ) #NEWLINE# if ( user in _users ) : #NEWLINE# #INDENT# log . debug ( 'user exists' ) #NEWLINE# ret [ 'comment' ] = os . linesep . join ( [ ret [ 'comment' ] , 'User {0} is already a member of group {1}.' . format ( user , group_name ) ] ) #NEWLINE# continue #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# log . debug ( 'user is set to be added {0}' . format ( user ) ) #NEWLINE# if __opts__ [ 'test' ] : #NEWLINE# #INDENT# ret [ 'comment' ] = 'User {0} is set to be added to group {1}.' . format ( user , group_name ) #NEWLINE# ret [ 'result' ] = None #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# __salt__ [ 'boto_iam.add_user_to_group' ] ( user , group_name , region , key , keyid , profile ) #NEWLINE# ret [ 'comment' ] = os . linesep . join ( [ ret [ 'comment' ] , 'User {0} has been added to group {1}.' . format ( user , group_name ) ] ) #NEWLINE# ret [ 'changes' ] [ user ] = group_name #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# for user in _users : #NEWLINE# #INDENT# if ( user not in users ) : #NEWLINE# #INDENT# if __opts__ [ 'test' ] : #NEWLINE# #INDENT# ret [ 'comment' ] = os . linesep . join ( [ ret [ 'comment' ] , 'User {0} is set to be removed from group {1}.' . format ( user , group_name ) ] ) #NEWLINE# ret [ 'result' ] = None #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# __salt__ [ 'boto_iam.remove_user_from_group' ] ( group_name = group_name , user_name = user , region = region , key = key , keyid = keyid , profile = profile ) #NEWLINE# ret [ 'comment' ] = os . linesep . join ( [ ret [ 'comment' ] , 'User {0} has been removed from group {1}.' . format ( user , group_name ) ] ) #NEWLINE# ret [ 'changes' ] [ user ] = 'Removed from group {0}.' . format ( group_name ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return ret