2011/devel/system/base/mudur/comar - apply changes that was made for corporate2 to 2011

Mehmet Özdemir paketler-commits at pardus.org.tr
Tue Dec 28 10:54:42 EET 2010


Author: mehmet.ozdemir
Date: Tue Dec 28 10:54:42 2010
New Revision: 108053

Modified:
   2011/devel/system/base/mudur/comar/disk.py
Log:
* apply changes that was made for corporate2 to 2011



---
 disk.py |   22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

Modified: 2011/devel/system/base/mudur/comar/disk.py
=================================================================
--- 2011/devel/system/base/mudur/comar/disk.py	(original)
+++ 2011/devel/system/base/mudur/comar/disk.py	Tue Dec 28 10:54:42 2010
@@ -333,7 +333,6 @@
             partText = 'LABEL='+getLabel(device)
         else:
             partText = 'UUID='+getUUID(device)
-        removeEntry(device, silent=True)
     else:
         partText = 'UUID='+getUUID(device)
     # Add new entry
@@ -346,17 +345,14 @@
     if not file(FSTAB).read()[-1] == '\n':
         file(FSTAB, 'a').write('\n')
     _options = ','.join(_options)
-    if _options:
-        file(FSTAB, 'a').write('%s %s %s %s 0 0\n' % (partText, path, fsType, _options))
-    else:
-        file(FSTAB, 'a').write('%s %s %s defaults 0 0\n' % (partText, path, fsType))
-    # Notify clients
-    notify("Disk.Manager", "changed", ())
+
+    addit = True
     # If the partition is not already mounted the given path and,
     # if the partition is not mounted anywhere, try to create a path
     # and mount there.
     if not path_own:
         if not createPath(device, path):
+            addit = False
             # Can't create new path
             fail(_(FAIL_PATH) % path)
         if not device in [x[0] for x in getMounted()]:
@@ -364,8 +360,18 @@
             try:
                 mount(device, path)
             except:
-                removeEntry(device, silent=True)
+                addit = False
                 raise
+    if addit:
+        # try to remove old entry before
+        if old_path:
+            removeEntry(device, silent=True)
+        if _options:
+            file(FSTAB, 'a').write('%s %s %s %s 0 0\n' % (partText, path, fsType, _options))
+        else:
+            file(FSTAB, 'a').write('%s %s %s defaults 0 0\n' % (partText, path, fsType))
+        # Notify clients
+        notify("Disk.Manager", "changed", ())
 
 def getEntry(device):
     entries = parseFstab(FSTAB)


More information about the paketler-commits mailing list