summaryrefslogtreecommitdiffstats
path: root/plugins/xserver.py
diff options
context:
space:
mode:
authorJoel Andres Granados <jgranado@redhat.com>2008-06-06 15:38:35 +0200
committerJoel Andres Granados <jgranado@redhat.com>2008-06-06 15:38:35 +0200
commitda774c803eb9159913faf9f7ac51d71e46e8f669 (patch)
treef14dec7a152666807cfca9dfc7a3b2ed12458fa3 /plugins/xserver.py
parent1ff467a036c75da807fff4f8924d7cbadc97e794 (diff)
downloadfirstaidkit-da774c803eb9159913faf9f7ac51d71e46e8f669.tar.gz
firstaidkit-da774c803eb9159913faf9f7ac51d71e46e8f669.tar.xz
firstaidkit-da774c803eb9159913faf9f7ac51d71e46e8f669.zip
Use the backup system spaces instead of the backup system backend. (xserver plugin)
Diffstat (limited to 'plugins/xserver.py')
-rw-r--r--plugins/xserver.py26
1 files changed, 8 insertions, 18 deletions
diff --git a/plugins/xserver.py b/plugins/xserver.py
index a7c98a3..b84d6fd 100644
--- a/plugins/xserver.py
+++ b/plugins/xserver.py
@@ -59,6 +59,7 @@ class Xserver(Plugin):
self.display = ":10"
self.confPath = "/etc/X11/xorg.conf"
self.backupName = None
+ self.backupSpace = self._backups.getBackup(self)
self._issue = SimpleIssue(self.name, "X server didn't start")
def prepare(self):
@@ -111,16 +112,10 @@ class Xserver(Plugin):
def backup(self):
if os.path.isfile(self.confPath):
- try:
- self.backupName = "Xconfig"
- self._backups.backupPath(self.confPath, self.backupName)
- except BackupException:
- self.backupName = "Xconfig"+os.getpid()
- self._backups.backupPath(self.confPath, self.backupName)
- self._result = ReturnSuccess
+ self.backupSpace.backupPath(self.confPath)
else:
self._reporting.info("%s does not exist." % self.confPath, level = PLUGIN, origin = self)
- self._result = ReturnSuccess
+ self._result = ReturnSuccess
def fix(self):
self._reporting.info("Starting the fix task.", level = PLUGIN, origin = self)
@@ -138,20 +133,15 @@ class Xserver(Plugin):
self._issue.set(fixed = (self._result == ReturnSuccess), reporting = self._reporting, level = PLUGIN, origin = self)
def restore(self):
- if self.backupName is None:
+ if not self.backupSpace.exists(path=self.confPath):
# This is the case where there is no config file.
self._reporting.info("The backedup file was not present. Assuming that xorg did not have a config file to begin with.",
level = PLUGIN, origin = self)
- self._result = ReturnSuccess
- return
-
- try:
+ else:
self._reporting.info("Restoring original file.", level = PLUGIN , origin = self)
- self._backups.restoreName(self.backupName)
- self._result = ReturnSuccess
- except BackupException:
- # This means that the backed up file was lost somewhere.
- raise GeneralPluginException(self, "Very ugly inconsistency with the backup files.")
+ self.backupSpace.restoreName(self.confPath)
+
+ self._result = ReturnSuccess
def clean(self):
self._result = ReturnSuccess