Ejemplo n.º 1
0
    def test_share_network_security_service_add(self):
        share_network_id = "fake_share_net_id"
        sec_service_id = "fake_sec_service_id"

        api.share_network_security_service_add(
            self.request, share_network_id, sec_service_id)

        mock_sn_sec_service_add = (
            self.manilaclient.share_networks.add_security_service)

        mock_sn_sec_service_add.assert_called_once_with(
            share_network_id, sec_service_id)
Ejemplo n.º 2
0
 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
Ejemplo n.º 3
0
 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