/[gli]/trunk/src/net/server/gliserv.py
Gentoo

Diff of /trunk/src/net/server/gliserv.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 939 Revision 940
412 def __init__(self, loc): 412 def __init__(self, loc):
413 self._path = loc 413 self._path = loc
414 self.shared_info = SharedInfo() 414 self.shared_info = SharedInfo()
415 415
416 def register_client(self, mac, ip): 416 def register_client(self, mac, ip):
417 self.shared_info.client_state[mac] = { 'ip': ip, 'install_status': "waiting for server", 'start_install': False } 417 self.shared_info.client_state[mac] = { 'ip': ip, 'install_status': "waiting for server", 'start_install': True }
418 for client in self.shared_info.clients: 418 for client in self.shared_info.clients:
419 if client['mac'] == mac: break 419 if client['mac'] == mac: break
420 else: 420 else:
421 self.shared_info.clients.append({ 'name': "", 'ip': "", 'mac': mac, 'profile': "" }) 421 self.shared_info.clients.append({ 'name': "", 'ip': "", 'mac': mac, 'profile': "" })
422 return True 422 return True
423 423
424 def get_client_config(self, mac): 424 def get_client_config(self, mac):
425 if not self.shared_info.client_state[mac]['start_installing']: 425 if not self.shared_info.client_state[mac]['start_install']:
426 return None 426 return ""
427 for client in self.shared_info.clients: 427 for client in self.shared_info.clients:
428 if client['mac'] == mac: 428 if client['mac'] == mac:
429 if not client['profile']: 429 if not client['profile']:
430 return None 430 return None
431 for profile in self.shared_info.profiles: 431 for profile in self.shared_info.profiles:
432 if profile['name'] == client['profile']: 432 if profile['name'] == client['profile']:
433 tmpfile = open(profile['ccxmlfile'], "r") 433 tmpfile = open(profile['ccxmlfile'], "r")
434 xml = "".join(tmpfile.readlines()) 434 xml = "".join(tmpfile.readlines())
435 tmpfile.close() 435 tmpfile.close()
436 return xml 436 return xml
437 return None 437 return ""
438 438
439 def get_install_profile(self, mac): 439 def get_install_profile(self, mac):
440 if not self.shared_info.client_state[mac]['start_installing']: 440 if not self.shared_info.client_state[mac]['start_install']:
441 return None 441 return ""
442 for client in self.shared_info.clients: 442 for client in self.shared_info.clients:
443 if client['mac'] == mac: 443 if client['mac'] == mac:
444 if not client['profile']: 444 if not client['profile']:
445 return None 445 return None
446 for profile in profiles: 446 for profile in self.shared_info.profiles:
447 if profile['name'] == client['profile']: 447 if profile['name'] == client['profile']:
448 tmpfile = open(profile['ipxmlfile'], "r") 448 tmpfile = open(profile['ipxmlfile'], "r")
449 xml = "".join(tmpfile.readlines()) 449 xml = "".join(tmpfile.readlines())
450 tmpfile.close() 450 tmpfile.close()
451 return xml 451 return xml
452 return ""
452 453
453 def update_client_status(self, mac, status): 454 def update_client_status(self, mac, status):
454 self.shared_info.client_state[mac]['install_status'] = status 455 self.shared_info.client_state[mac]['install_status'] = status
456 return True
455 457
456def register(): 458def register():
457 host = '' 459 host = ''
458 port = 8001 460 port = 8001
459 buf = 1024 461 buf = 1024

Legend:
Removed from v.939  
changed lines
  Added in v.940

  ViewVC Help
Powered by ViewVC 1.1.20