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
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)
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
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