@@ -565,33 +565,42 @@ def take_action(self, parsed_args):
565565 msg = _ ('--force cannot be used with --class or --default' )
566566 raise exceptions .CommandError (msg )
567567
568- compute_client = self .app .client_manager .sdk_connection .compute
569- volume_client = self .app .client_manager .sdk_connection .volume
570-
571568 compute_kwargs = {}
572- for k , v in COMPUTE_QUOTAS .items ():
573- value = getattr (parsed_args , k , None )
574- if value is not None :
575- compute_kwargs [k ] = value
569+ volume_kwargs = {}
570+ network_kwargs = {}
576571
577- if compute_kwargs and parsed_args . force is True :
578- compute_kwargs [ 'force' ] = parsed_args . force
572+ if self . app . client_manager . is_compute_endpoint_enabled () :
573+ compute_client = self . app . client_manager . sdk_connection . compute
579574
580- volume_kwargs = {}
581- for k , v in VOLUME_QUOTAS .items ():
582- value = getattr (parsed_args , k , None )
583- if value is not None :
584- if parsed_args .volume_type and k in IMPACT_VOLUME_TYPE_QUOTAS :
585- k = k + '_%s' % parsed_args .volume_type
586- volume_kwargs [k ] = value
575+ for k , v in COMPUTE_QUOTAS .items ():
576+ value = getattr (parsed_args , k , None )
577+ if value is not None :
578+ compute_kwargs [k ] = value
579+
580+ if compute_kwargs and parsed_args .force is True :
581+ compute_kwargs ['force' ] = parsed_args .force
582+
583+ if self .app .client_manager .is_volume_endpoint_enabled ():
584+ volume_client = self .app .client_manager .sdk_connection .volume
585+
586+ for k , v in VOLUME_QUOTAS .items ():
587+ value = getattr (parsed_args , k , None )
588+ if value is not None :
589+ if (
590+ parsed_args .volume_type
591+ and k in IMPACT_VOLUME_TYPE_QUOTAS
592+ ):
593+ k = k + '_%s' % parsed_args .volume_type
594+ volume_kwargs [k ] = value
587595
588- network_kwargs = {}
589596 if self .app .client_manager .is_network_endpoint_enabled ():
597+ network_client = self .app .client_manager .network
598+
590599 for k , v in NETWORK_QUOTAS .items ():
591600 value = getattr (parsed_args , k , None )
592601 if value is not None :
593602 network_kwargs [k ] = value
594- else :
603+ elif self . app . client_manager . is_compute_endpoint_enabled () :
595604 for k , v in NOVA_NETWORK_QUOTAS .items ():
596605 value = getattr (parsed_args , k , None )
597606 if value is not None :
@@ -632,11 +641,7 @@ def take_action(self, parsed_args):
632641 compute_client .update_quota_set (project , ** compute_kwargs )
633642 if volume_kwargs :
634643 volume_client .update_quota_set (project , ** volume_kwargs )
635- if (
636- network_kwargs
637- and self .app .client_manager .is_network_endpoint_enabled ()
638- ):
639- network_client = self .app .client_manager .network
644+ if network_kwargs :
640645 network_client .update_quota (project , ** network_kwargs )
641646
642647
0 commit comments