improve condition of the domain_id
This commit is contained in:
		@ -89,6 +89,8 @@ class ServiceCatalogModule(OTCModule):
 | 
			
		||||
        parsed_domain = urlparse(identity_url)
 | 
			
		||||
        self.identity_ext_base = '%s://%s/v3.0' % (
 | 
			
		||||
            parsed_domain.scheme, parsed_domain.netloc)
 | 
			
		||||
        self.real_domain_id = self.conn.session.auth.get_access(
 | 
			
		||||
            self.conn.session).domain_id
 | 
			
		||||
 | 
			
		||||
    def _update_service(self, existing, name, description, is_enabled):
 | 
			
		||||
        _url = self.sdk.utils.urljoin(
 | 
			
		||||
@ -112,7 +114,10 @@ class ServiceCatalogModule(OTCModule):
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    def _delete_service(self, current):
 | 
			
		||||
        if not hasattr(current, "domain_id") or not current.domain_id:
 | 
			
		||||
        if not (
 | 
			
		||||
            hasattr(current, "domain_id")
 | 
			
		||||
            and current.domain_id != self.real_domain_id
 | 
			
		||||
        ):
 | 
			
		||||
            conn = self.conn
 | 
			
		||||
        else:
 | 
			
		||||
            conn = self.conn.connect_as(target_domain_id=current.domain_id)
 | 
			
		||||
@ -191,8 +196,14 @@ class ServiceCatalogModule(OTCModule):
 | 
			
		||||
            target_name = target_srv.get('name')
 | 
			
		||||
            target_enabled = target_srv.get('enabled', True)
 | 
			
		||||
            target_description = target_srv.get('description')
 | 
			
		||||
            if srv_type and srv_type in existing_service_per_type:
 | 
			
		||||
            current_srv = existing_service_per_type.get(srv_type)
 | 
			
		||||
            if (
 | 
			
		||||
                current_srv
 | 
			
		||||
                and (
 | 
			
		||||
                    current_srv.domain_id == self.real_domain_id
 | 
			
		||||
                    or not current_srv.domain_id
 | 
			
		||||
                )
 | 
			
		||||
            ):
 | 
			
		||||
                if _is_srv_update_necessary(
 | 
			
		||||
                        current_srv, target_name,
 | 
			
		||||
                        target_description, target_enabled):
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user