summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorJoel Andres Granados <jgranado@redhat.com>2008-05-06 20:13:53 +0200
committerJoel Andres Granados <jgranado@redhat.com>2008-05-07 19:31:29 +0200
commit2210ac832247cf1cc1f3638a83dedec02bd49250 (patch)
tree37a52997bc3bbfe4d34f1ce70018cf6f6cafc13f /plugins
parenta80332968c0b2235696fc46dfc2faf00ad450f4f (diff)
downloadfirstaidkit-2210ac832247cf1cc1f3638a83dedec02bd49250.tar.gz
firstaidkit-2210ac832247cf1cc1f3638a83dedec02bd49250.tar.xz
firstaidkit-2210ac832247cf1cc1f3638a83dedec02bd49250.zip
Fix the behavior of xserver plugin to reflect new Xorg server behavior.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/xserver.py63
1 files changed, 50 insertions, 13 deletions
diff --git a/plugins/xserver.py b/plugins/xserver.py
index 0b2f238..8ce42be 100644
--- a/plugins/xserver.py
+++ b/plugins/xserver.py
@@ -34,7 +34,16 @@ import shutil
class Xserver(Plugin):
""" Plugin to detect an rescue faulty xserver configurations. """
-
+ flows = {}
+ flows["force"] = Flow({
+ Plugin.initial: {Return: "prepare"},
+ "prepare" : {ReturnSuccess: "diagnose2"},
+ "diagnose2" : {ReturnSuccess: "clean", ReturnFailure: "backup"},
+ "backup" : {ReturnSuccess: "fix", ReturnFailure: "clean"},
+ "restore" : {ReturnSuccess: "clean", ReturnFailure: "clean"},
+ "fix" : {ReturnSuccess: "clean", ReturnFailure: "restore"},
+ "clean" : {ReturnSuccess: Plugin.final}
+ }, description="This flow skips the search for the xserver lock file")
name = "X server"
version = "0.0.1"
author = "Joel Andres Granados"
@@ -50,16 +59,50 @@ class Xserver(Plugin):
self._result = ReturnSuccess
self._issue.set(reporting = self._reporting, level = PLUGIN, origin = self)
- # If we cant start the server
def diagnose(self):
+ # Lets see if there is a server active.
+ if os.path.exists("/tmp/.X0-lock")
+ self._reporting.info("An X server is already running.", level = PLUGIN, origin = self)
+ self._resulting.info("You can run the \"force\" flow to avoud this check. In some cases it works.",
+ level = PLUGIN, origin = self)
+ serl._result = ReturnSuccess
+
+ elif self.serverStart():
+ self._reporting.info("Everything seems ok with the X server.", level = PLUGIN, origin = self)
+ self._result = ReturnSuccess
+
+ elif !os.path.exists(self.confPath)
+ # If the configuration is not there dont even bother to try fixing it.
+ # This will go through the proces of trying to fix it. at least we told the user.
+ self._reporting.info("The error is in the xservers autodetection mechanism, this does not have an automated solution yet.",
+ level = PLUGIN, origin = self)
+ self._result = ReturnFailure
+
+ else:
+ self._reporting.info("X server is missconfigured.", level = PLUGIN, origin = self)
+ self._result = ReturnFailure
+ self._issue.set(detected = True, happened = (self._result == ReturnFailure), reporting = self._reporting, level = PLUGIN, origin = self)
+
+ def diagnose2(self):
+ """Just a diagnose without the lock check"""
if self.serverStart():
self._reporting.info("Everything seems ok with the X server.", level = PLUGIN, origin = self)
self._result = ReturnSuccess
+
+ elif !os.path.exists(self.confPath)
+ # If the configuration is not there dont even bother to try fixing it.
+ # This will go through the proces of trying to fix it. at least we told the user.
+ self._reporting.info("The error is in the xservers autodetection mechanism, this does not have an automated solution yet.",
+ level = PLUGIN, origin = self)
+ self._result = ReturnFailure
+
else:
self._reporting.info("X server is missconfigured.", level = PLUGIN, origin = self)
self._result = ReturnFailure
self._issue.set(detected = True, happened = (self._result == ReturnFailure), reporting = self._reporting, level = PLUGIN, origin = self)
+
+
# FIXME:Must change this when the backup utils is done.
def backup(self):
if os.path.isfile(self.confPath):
@@ -76,17 +119,11 @@ class Xserver(Plugin):
def fix(self):
self._reporting.info("Starting the fix task.", level = PLUGIN, origin = self)
- xserver = rhpxl.xserver.XServer()
- self._reporting.info("Probing for HardWare.", level = PLUGIN, origin = self)
- xserver.probeHW()
- xserver.setHWState()
- xserver.keyboard = rhpl.keyboard.Keyboard()
- self._reporting.info("Generating configuration file.", level = PLUGIN, origin = self)
- xserver.generateConfig()
- self._reporting.info("Writing configuration file to %s."%self.confPath, level = PLUGIN, origin = self)
- xserver.writeConfig(self.confPath)
-
- self._reporting.info("Testing created file", level = PLUGIN, origin = self)
+ # With the current xorg server the only thing that we need to do is to erase the conf file.
+ if os.path.exists(self.confPath)
+ os.remove(self.confPath)
+
+ self._reporting.info("Testing modified environment", level = PLUGIN, origin = self)
if self.serverStart():
self._reporting.info("X server started successfully with new file.", level = PLUGIN, origin = self)
self._result = ReturnSuccess