[blivet:rhel7/master 07/16] Make name an abstract property (#1038590)

mulhern amulhern at redhat.com
Thu Jan 16 16:10:08 UTC 2014


Related: rhbz#1038590

It is tidier to get rid of the class field which is only used in the name
method.

Signed-off-by: mulhern <amulhern at redhat.com>
---
 blivet/formats/fslabel.py | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/blivet/formats/fslabel.py b/blivet/formats/fslabel.py
index 30ac3d0..6b0b48c 100644
--- a/blivet/formats/fslabel.py
+++ b/blivet/formats/fslabel.py
@@ -29,13 +29,13 @@ class FSLabelApp(object):
 
     __metaclass__ = abc.ABCMeta
 
-    @property
+    @abc.abstractproperty
     def name(self):
         """The name of the filesystem labeling application.
 
            :rtype: str
         """
-        return self._name
+        raise NotImplementedError
 
     @abc.abstractproperty
     def reads(self):
@@ -118,7 +118,9 @@ class FSLabelApp(object):
 class E2Label(FSLabelApp):
     """Application used by ext2 and its descendants."""
 
-    _name = "e2label"
+    @property
+    def name(self):
+        return "e2label"
 
     @property
     def reads(self):
@@ -142,7 +144,9 @@ class E2Label(FSLabelApp):
 class DosFsLabel(FSLabelApp):
     """Application used by FATFS."""
 
-    _name = "dosfslabel"
+    @property
+    def name(self):
+        return "dosfslabel"
 
     @property
     def reads(self):
@@ -166,7 +170,9 @@ class DosFsLabel(FSLabelApp):
 class JFSTune(FSLabelApp):
     """Application used by JFS."""
 
-    _name = "jfs_tune"
+    @property
+    def name(self):
+        return "jfs_tune"
 
     @property
     def reads(self):
@@ -190,7 +196,9 @@ class JFSTune(FSLabelApp):
 class ReiserFSTune(FSLabelApp):
     """Application used by ReiserFS."""
 
-    _name = "reiserfstune"
+    @property
+    def name(self):
+        return "reiserfstune"
 
     @property
     def reads(self):
@@ -214,7 +222,9 @@ class ReiserFSTune(FSLabelApp):
 class XFSAdmin(FSLabelApp):
     """Application used by XFS."""
 
-    _name = "xfs_admin"
+    @property
+    def name(self):
+        return "xfs_admin"
 
     @property
     def reads(self):
-- 
1.8.3.1



More information about the anaconda-patches mailing list