#NEWLINE# def get_server_groups( self ) : #NEWLINE# #INDENT# '\n        Return list of dictionaries containing server group details\n\n        Returns:\n            list: Empty if no server groups exist or server groups are not\n                supported\n\n            [\n                {\n                    "user": "<user name>",\n                    "tenant": "<tenant name>",\n                    "uuid": "<group uuid>",\n                    "name": "<group name>",\n                    "policies": [<policy_name>, ...]\n                }\n            ]\n        ' #NEWLINE# groups = [ ] #NEWLINE# try : #NEWLINE# #INDENT# with proxy_client . expect_exception ( nova_exc . NotFound ) : #NEWLINE# #INDENT# self . _nova_client . server_groups . list ( ) #NEWLINE# #UNINDENT# for row in self . _execute ( SQL_SELECT_ALL_GROUPS ) . fetchall ( ) : #NEWLINE# #INDENT# LOG . debug ( 'Resulting row: %s' , row ) #NEWLINE# sql = ( SQL_SELECT_POLICY % row [ 4 ] ) #NEWLINE# policies = [ ] #NEWLINE# for policy in self . _execute ( sql ) . fetchall ( ) : #NEWLINE# #INDENT# policies . append ( policy [ 0 ] ) #NEWLINE# #UNINDENT# tenant_name = self . identity . try_get_tenant_name_by_id ( row [ 1 ] ) #NEWLINE# if ( tenant_name is None ) : #NEWLINE# #INDENT# LOG . info ( "Tenant '%s' does not exist on the SRC. Skipping server group '%s'..." , row [ 1 ] , row [ 3 ] ) #NEWLINE# continue #NEWLINE# #UNINDENT# groups . append ( { #NEWLINE# #INDENT# 'user' : self . identity . try_get_username_by_id ( row [ 0 ] ) , #NEWLINE# 'tenant' : tenant_name , #NEWLINE# 'uuid' : row [ 2 ] , #NEWLINE# 'name' : groups [ 3 ] , #NEWLINE# 'policies' : policies , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# #UNINDENT# except nova_exc . NotFound : #NEWLINE# #INDENT# LOG . info ( 'Cloud does not support server_groups' ) #NEWLINE# #UNINDENT# return groups