dans l'optique de remettre ClusterController en production, les administateurs peuvent désormais ajouter ou supprimer une machine du contrôle du cluster controller
This commit is contained in:
parent
2c807fefe2
commit
d67c4d6a21
|
@ -57,17 +57,17 @@ class ClusterNode:
|
||||||
bUpdateRequiredChecks = True
|
bUpdateRequiredChecks = True
|
||||||
if bUpdateRequiredChecks:
|
if bUpdateRequiredChecks:
|
||||||
if self.m_powerState == PowerState.ON:
|
if self.m_powerState == PowerState.ON:
|
||||||
self.m_machineStatusUpdater.m_bCheckPowerState = True
|
self.m_machineStatusUpdater.m_bCheckPowerState = True
|
||||||
self.m_machineStatusUpdater.m_bCheckSensors = True
|
self.m_machineStatusUpdater.m_bCheckSensors = True
|
||||||
elif self.m_powerState == PowerState.OFF:
|
elif self.m_powerState == PowerState.OFF:
|
||||||
self.m_machineStatusUpdater.m_bCheckPowerState = True
|
self.m_machineStatusUpdater.m_bCheckPowerState = True
|
||||||
self.m_machineStatusUpdater.m_bCheckSensors = False
|
self.m_machineStatusUpdater.m_bCheckSensors = False
|
||||||
elif self.m_powerState == PowerState.SLEEP:
|
elif self.m_powerState == PowerState.SLEEP:
|
||||||
self.m_machineStatusUpdater.m_bCheckPowerState = True
|
self.m_machineStatusUpdater.m_bCheckPowerState = True
|
||||||
self.m_machineStatusUpdater.m_bCheckSensors = False
|
self.m_machineStatusUpdater.m_bCheckSensors = False
|
||||||
elif self.m_powerState == PowerState.UNPLUGGED:
|
elif self.m_powerState == PowerState.UNPLUGGED:
|
||||||
self.m_machineStatusUpdater.m_bCheckPowerState = True
|
self.m_machineStatusUpdater.m_bCheckPowerState = True
|
||||||
self.m_machineStatusUpdater.m_bCheckSensors = False
|
self.m_machineStatusUpdater.m_bCheckSensors = False
|
||||||
else:
|
else:
|
||||||
assert( False )
|
assert( False )
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import threading
|
||||||
import Util
|
import Util
|
||||||
#import pri
|
#import pri
|
||||||
from urlparse import urlparse, parse_qs
|
from urlparse import urlparse, parse_qs
|
||||||
|
import xml.dom.minidom
|
||||||
#>>> url = 'http://example.com/?foo=bar&one=1'
|
#>>> url = 'http://example.com/?foo=bar&one=1'
|
||||||
#>>> parse_qs(urlparse(url).query)
|
#>>> parse_qs(urlparse(url).query)
|
||||||
#{'foo': ['bar'], 'one': ['1']}
|
#{'foo': ['bar'], 'one': ['1']}
|
||||||
|
@ -36,12 +37,23 @@ class MyHandler(BaseHTTPRequestHandler):
|
||||||
return
|
return
|
||||||
if self.path.endswith("ShowControlledMachines"): #http://simpatix10.univ-rennes1.fr:8080/ShowControlledMachines
|
if self.path.endswith("ShowControlledMachines"): #http://simpatix10.univ-rennes1.fr:8080/ShowControlledMachines
|
||||||
self.send_response(200)
|
self.send_response(200)
|
||||||
self.send_header('Content-type', 'text/html')
|
self.send_header('Content-type', 'text/xml')
|
||||||
self.end_headers()
|
self.end_headers()
|
||||||
self.wfile.write("hey, today is the" + str(time.localtime()[7]))
|
|
||||||
self.wfile.write(" day in the year " + str(time.localtime()[0]))
|
# Create the minidom document
|
||||||
|
doc = xml.dom.minidom.Document()
|
||||||
|
|
||||||
|
# Create the <ControlledMachines> root element
|
||||||
|
controlledMachinesElement = doc.createElement("ControlledMachines")
|
||||||
|
doc.appendChild(controlledMachinesElement)
|
||||||
|
|
||||||
for machine in self.server.m_clusterController.m_clusterStatus.m_clusterNodes.itervalues():
|
for machine in self.server.m_clusterController.m_clusterStatus.m_clusterNodes.itervalues():
|
||||||
self.wfile.write("%s is controlled by ClusterController" % machine.getName())
|
# Create the main <card> element
|
||||||
|
controlledMachineElement = doc.createElement("Machine")
|
||||||
|
controlledMachineElement.setAttribute("name", machine.getName())
|
||||||
|
controlledMachinesElement.appendChild(controlledMachineElement)
|
||||||
|
# Print our newly created XML
|
||||||
|
self.wfile.write(doc.toprettyxml(indent=" "))
|
||||||
return
|
return
|
||||||
if urlparse(self.path).path == '/SetControlOnMachine': #http://simpatix10.univ-rennes1.fr:8080/SetControlOnMachine?machineName=simpatix30&control=1
|
if urlparse(self.path).path == '/SetControlOnMachine': #http://simpatix10.univ-rennes1.fr:8080/SetControlOnMachine?machineName=simpatix30&control=1
|
||||||
machineName = paramsDict['machineName'][0]
|
machineName = paramsDict['machineName'][0]
|
||||||
|
|
Loading…
Reference in New Issue