#NEWLINE# def update( self , req , id , body ) : #NEWLINE# #INDENT# 'Add or modify domain entry.' #NEWLINE# context = req . environ [ 'nova.context' ] #NEWLINE# authorize ( context ) #NEWLINE# nova_context . require_admin_context ( context ) #NEWLINE# fqdomain = _unquote_domain ( id ) #NEWLINE# try : #NEWLINE# #INDENT# entry = body [ 'domain_entry' ] #NEWLINE# scope = entry [ 'scope' ] #NEWLINE# #UNINDENT# except ( TypeError , KeyError ) : #NEWLINE# #INDENT# raise webob . exc . HTTPUnprocessableEntity ( ) #NEWLINE# #UNINDENT# project = entry . get ( 'project' , None ) #NEWLINE# av_zone = entry . get ( 'availability_zone' , None ) #NEWLINE# if ( ( scope not in ( 'private' , 'public' ) ) or ( project and av_zone ) or ( ( scope == 'private' ) and project ) or ( ( scope == 'public' ) and av_zone ) ) : #NEWLINE# #INDENT# raise webob . exc . HTTPUnprocessableEntity ( ) #NEWLINE# #UNINDENT# if ( scope == 'private' ) : #NEWLINE# #INDENT# create_dns_domain = self . network_api . create_private_dns_domain #NEWLINE# ( area_name , area ) = ( 'availability_zone' , av_zone ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# create_dns_domain = self . network_api . create_public_dns_domain #NEWLINE# ( area_name , area ) = ( 'project' , project ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# create_dns_domain ( context , fqdomain , area ) #NEWLINE# #UNINDENT# except NotImplementedError : #NEWLINE# #INDENT# msg = _ ( 'Unable to create dns domain' ) #NEWLINE# raise webob . exc . HTTPNotImplemented ( explanation = msg ) #NEWLINE# #UNINDENT# return _translate_domain_entry_view ( { #NEWLINE# #INDENT# 'domain' : fqdomain , #NEWLINE# 'scope' : scope , #NEWLINE# area_name : area , #NEWLINE# #UNINDENT# } )