Permalink
Browse files

Rename iSCSI resource names for better looking

  • Loading branch information...
1 parent d2c97dd commit 03750f9e28cd9b3673401c5b8275851744d91115 @william-gr william-gr committed Sep 11, 2013
Showing with 32 additions and 4 deletions.
  1. +12 −0 gui/api/resources.py
  2. +14 −3 gui/api/tests/services.py
  3. +2 −1 gui/api/tests/utils.py
  4. +2 −0 gui/services/admin.py
  5. +2 −0 gui/services/models.py
View
@@ -1109,13 +1109,19 @@ def dehydrate(self, bundle):
class ISCSITargetResourceMixin(object):
+ class Meta:
+ resource_name = 'services/iscsi/target'
+
def dehydrate(self, bundle):
bundle = super(ISCSITargetResourceMixin, self).dehydrate(bundle)
return bundle
class ISCSIPortalResourceMixin(object):
+ class Meta:
+ resource_name = 'services/iscsi/portal'
+
def dehydrate(self, bundle):
bundle = super(ISCSIPortalResourceMixin, self).dehydrate(bundle)
listen = ["%s:%s" % (
@@ -1199,6 +1205,9 @@ def save_m2m(self, m2m_bundle):
class ISCSITargetToExtentResourceMixin(object):
+ class Meta:
+ resource_name = 'services/iscsi/targettoextent'
+
def dehydrate(self, bundle):
bundle = super(ISCSITargetToExtentResourceMixin, self).dehydrate(
bundle
@@ -1214,6 +1223,9 @@ def dehydrate(self, bundle):
class ISCSITargetExtentResourceMixin(object):
+ class Meta:
+ resource_name = 'services/iscsi/extent'
+
def dehydrate(self, bundle):
bundle = super(ISCSITargetExtentResourceMixin, self).dehydrate(bundle)
if bundle.obj.iscsi_target_extent_type == 'Disk':
View
@@ -1115,6 +1115,8 @@ def test_Delete(self):
class iSCSITargetGlobalConfigurationResourceTest(APITestCase):
+ resource_name = 'services/iscsi/globalconfiguration'
+
def setUp(self):
super(iSCSITargetGlobalConfigurationResourceTest, self).setUp()
self._obj = models.iSCSITargetGlobalConfiguration.objects.create(
@@ -1190,6 +1192,8 @@ def test_Delete(self):
class iSCSITargetExtentResourceTest(APITestCase):
+ resource_name = 'services/iscsi/extent'
+
def setUp(self):
super(iSCSITargetExtentResourceTest, self).setUp()
models.services.objects.create(
@@ -1290,6 +1294,8 @@ def test_Delete(self):
class iSCSITargetAuthorizedInitiatorResourceTest(APITestCase):
+ resource_name = 'services/iscsi/authorizedinitiator'
+
def setUp(self):
super(iSCSITargetAuthorizedInitiatorResourceTest, self).setUp()
models.services.objects.create(
@@ -1381,6 +1387,8 @@ def test_Delete(self):
class iSCSITargetAuthCredentialResourceTest(APITestCase):
+ resource_name = 'services/iscsi/authcredential'
+
def setUp(self):
super(iSCSITargetAuthCredentialResourceTest, self).setUp()
models.services.objects.create(
@@ -1474,7 +1482,8 @@ def test_Delete(self):
class iSCSITargetResourceTest(APITestCase):
- maxDiff = None
+ resource_name = 'services/iscsi/target'
+
def setUp(self):
super(iSCSITargetResourceTest, self).setUp()
models.services.objects.create(
@@ -1578,7 +1587,8 @@ def test_Delete(self):
class iSCSITargetToExtentResourceTest(APITestCase):
- maxDiff = None
+ resource_name = 'services/iscsi/targettoextent'
+
def setUp(self):
super(iSCSITargetToExtentResourceTest, self).setUp()
models.services.objects.create(
@@ -1667,7 +1677,8 @@ def test_Delete(self):
class iSCSITargetPortalResourceTest(APITestCase):
- maxDiff = None
+ resource_name = 'services/iscsi/portal'
+
def setUp(self):
super(iSCSITargetPortalResourceTest, self).setUp()
models.services.objects.create(
View
@@ -60,7 +60,8 @@ def __new__(cls, name, bases, attrs):
if name.endswith('ResourceTest'):
rsname = name.replace('ResourceTest', '').lower()
app = new_class.__module__.rsplit('.', 1)[-1]
- new_class.resource_name = "%s/%s" % (app, rsname)
+ if new_class.resource_name is None:
+ new_class.resource_name = "%s/%s" % (app, rsname)
return new_class
View
@@ -86,6 +86,8 @@ class ISCSIAuthCredentialFAdmin(BaseFreeAdmin):
'iscsi_target_auth_peersecret',
)
+ resource_name = 'services/iscsi/authcredential'
+
class ISCSITargetToExtentFAdmin(BaseFreeAdmin):
View
@@ -483,6 +483,7 @@ class FreeAdmin:
menu_child_of = "services.ISCSI"
icon_model = u"SettingsIcon"
nav_extra = {'type': 'iscsi'}
+ resource_name = 'services/iscsi/globalconfiguration'
class iSCSITargetExtent(Model):
@@ -661,6 +662,7 @@ class FreeAdmin:
icon_model = u"InitiatorIcon"
icon_add = u"AddInitiatorIcon"
icon_view = u"ViewAllInitiatorsIcon"
+ resource_name = 'services/iscsi/authorizedinitiator'
def __unicode__(self):
if self.iscsi_target_initiator_comment != "":

0 comments on commit 03750f9

Please sign in to comment.