[blivet:master 06/17] Virtualize options property methods in DeviceFormat.options definition.

mulhern amulhern at redhat.com
Tue Jan 6 20:38:08 UTC 2015


_setOptions and _getOptions are overridden in a few places.
Remove any redundant definitions of options property in these places.

Signed-off-by: mulhern <amulhern at redhat.com>
---
 blivet/formats/__init__.py | 6 +++++-
 blivet/formats/fs.py       | 7 -------
 blivet/formats/swap.py     | 3 ---
 3 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/blivet/formats/__init__.py b/blivet/formats/__init__.py
index 907eb20..da1e829 100644
--- a/blivet/formats/__init__.py
+++ b/blivet/formats/__init__.py
@@ -289,7 +289,11 @@ class DeviceFormat(ObjectID):
     def _getOptions(self):
         return self._options
 
-    options = property(_getOptions, _setOptions)
+    options = property(
+       lambda s: s._getOptions(),
+       lambda s,v: s._setOptions(v),
+       doc="fstab entry option string"
+    )
 
     def _setDevice(self, devspec):
         if devspec and not devspec.startswith("/"):
diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
index 27a2bc4..060d990 100644
--- a/blivet/formats/fs.py
+++ b/blivet/formats/fs.py
@@ -839,8 +839,6 @@ class FS(DeviceFormat):
     def _setOptions(self, options):
         self.mountopts = options
 
-    options = property(_getOptions, _setOptions)
-
     @property
     def mountType(self):
         if not self._mountType:
@@ -1625,11 +1623,6 @@ class TmpFS(NoDevFS):
     def _setOptions(self, options):
         self._options = options
 
-    # override the options property
-    # so that the size and other options
-    # are correctly added to fstab
-    options = property(_getOptions, _setOptions)
-
     @property
     def size(self):
         return self._size
diff --git a/blivet/formats/swap.py b/blivet/formats/swap.py
index ce85a6a..bb3eaff 100644
--- a/blivet/formats/swap.py
+++ b/blivet/formats/swap.py
@@ -131,9 +131,6 @@ class SwapSpace(DeviceFormat):
                 except ValueError:
                     log.info("invalid value for swap priority: %s", arg)
 
-    options = property(_getOptions, _setOptions,
-                       doc="The swap device's fstab options string")
-
     @property
     def status(self):
         """ Device status. """
-- 
1.9.3



More information about the anaconda-patches mailing list