def test_share_network_update(self, name, description): share_net_id = "fake_share_network" api.share_network_update(self.request, share_net_id, name, description) self.manilaclient.share_networks.update.assert_called_once_with( share_net_id, name=name, description=description)
def handle(self, request, data, *args, **kwargs): share_net_id = self.initial['share_network_id'] try: manila.share_network_update(request, share_net_id, name=data['name'], description=data['description']) message = _('Updating share network "%s"') % data['name'] messages.info(request, message) return True except Exception: redirect = reverse("horizon:project:shares:index") exceptions.handle(request, _('Unable to update share network.'), redirect=redirect)
def handle(self, request, context): try: manila.share_network_update(request, context['id'], description=context['description'], name=context['name']) sec_services = manila.security_service_list( request, search_opts={'share_network_id': context['id']}) sec_services_old = set( [sec_service.id for sec_service in sec_services]) sec_services_new = set(context['security_service']) for sec_service in sec_services_new - sec_services_old: manila.share_network_security_service_add( request, context['id'], sec_service) for sec_service in sec_services_old - sec_services_new: manila.share_network_security_service_remove( request, context['id'], sec_service) return True except Exception: exceptions.handle(request, _('Unable to update share network.')) return False
def handle(self, request, context): try: manila.share_network_update(request, context['id'], description=context['description'], name=context['name']) sec_services = manila.security_service_list(request, search_opts={ 'share_network_id': context['id']}) sec_services_old = set([sec_service.id for sec_service in sec_services]) sec_services_new = set(context['security_service']) for sec_service in sec_services_new - sec_services_old: manila.share_network_security_service_add(request, context['id'], sec_service) for sec_service in sec_services_old - sec_services_new: manila.share_network_security_service_remove(request, context['id'], sec_service) return True except Exception: exceptions.handle(request, _('Unable to update share network.')) return False