示例#1
0
 def get_data(self, request, rule_id):
     rules = manila.share_rules_list(request, self.table.kwargs['share_id'])
     if rules:
         for rule in rules:
             if rule.id == rule_id:
                 return rule
     raise exceptions.NotFound
示例#2
0
文件: tables.py 项目: jcsp/manila-ui
 def get_data(self, request, rule_id):
     rules = manila.share_rules_list(request, self.table.kwargs['share_id'])
     if rules:
         for rule in rules:
             if rule.id == rule_id:
                 return rule
     raise exceptions.NotFound
示例#3
0
    def test_share_rules_list(self):
        result = api.share_rules_list(self.request, self.id)

        self.assertEqual(
            self.manilaclient.shares.access_list.return_value, result)

        self.manilaclient.shares.access_list.assert_called_once_with(self.id)
示例#4
0
 def get_data(self):
     try:
         share_id = self.kwargs['share_id']
         rules = manila.share_rules_list(self.request, share_id)
     except Exception:
         redirect = reverse('horizon:project:shares:index')
         exceptions.handle(self.request,
                           _('Unable to retrieve share rules.'),
                           redirect=redirect)
     return rules
示例#5
0
 def get_data(self):
     try:
         share_id = self.kwargs['share_id']
         rules = manila.share_rules_list(self.request, share_id)
     except Exception:
         redirect = reverse('horizon:project:shares:index')
         exceptions.handle(self.request,
                           _('Unable to retrieve share rules.'),
                           redirect=redirect)
     return rules
示例#6
0
 def get_data(self):
     try:
         share_id = self.kwargs['share_id']
         share = manila.share_get(self.request, share_id)
         share.rules = manila.share_rules_list(self.request, share_id)
         share.export_locations = manila.share_export_location_list(
             self.request, share_id)
         share.el_size = self._calculate_size_of_longest_export_location(
             share.export_locations)
     except Exception:
         redirect = reverse('horizon:project:shares:index')
         exceptions.handle(self.request,
                           _('Unable to retrieve share details.'),
                           redirect=redirect)
     return share
示例#7
0
 def get_data(self):
     try:
         share_id = self.kwargs['share_id']
         share = manila.share_get(self.request, share_id)
         share.rules = manila.share_rules_list(self.request, share_id)
         share.export_locations = manila.share_export_location_list(
             self.request, share_id)
         share.el_size = self._calculate_size_of_longest_export_location(
             share.export_locations)
     except Exception:
         redirect = reverse('horizon:project:shares:index')
         exceptions.handle(self.request,
                           _('Unable to retrieve share details.'),
                           redirect=redirect)
     return share