File fix-powermanagement-status.dif of Package cobbler.3314
Index: cobbler-2.6.6/cobbler/action_power.py
===================================================================
--- cobbler-2.6.6.orig/cobbler/action_power.py
+++ cobbler-2.6.6/cobbler/action_power.py
@@ -104,17 +104,15 @@ class PowerTool:
if rc == 0:
# If the desired state is actually a query for the status
# return different information than command return code
+ # fence-agents have the following return codes on status
+ # 0 == on
+ # 2 == off
+ # else == Error / Unknown
if desired_state == 'status':
- match = re.match('(^Status:\s)(on|off)', output, re.IGNORECASE)
- if match:
- power_status = match.groups()[1]
- if power_status.lower() == 'on':
- return True
- else:
- return False
- utils.die(self.logger,"command succeeded (rc=%s), but output ('%s') was not understood" % (rc, output))
- return None
+ return True
break
+ elif rc == 2 and desired_state == 'status':
+ return False
else:
time.sleep(2)