root/pxe/syncbootnames

Revision 68562da7dfe4737bbb31946295181c8b0764e5f7, 1.3 KB (checked in by Frederic Lepied <frederic.lepied@…>, 3 years ago)

check if the local profile is present

  • Property mode set to 100755
Line 
1#!/usr/bin/python
2#---------------------------------------------------------------
3# Project         : pxemngr
4# File            : syncbootnames
5# Copyright       : 2009 Splitted-Desktop Systems
6# Author          : Frederic Lepied
7# Created On      : Sun Feb  1 19:17:33 2009
8# Purpose         : read the pxe directory containing the profiles
9#                   and add them to the database as available.
10#---------------------------------------------------------------
11
12import os
13import settings
14from pxe.models import *
15from pxe.common import *
16
17l = len(settings.PXE_SUFFIX)
18list = []
19for f in os.listdir(settings.PXE_ROOT + '/' + settings.PXE_PROFILES):
20    if f[-l:] == settings.PXE_SUFFIX:
21        list.append(f[:-l])
22
23if 'local' not in list:
24    print 'error local profile not present. Add it with a content like this:'
25    print
26    print '''prompt 0
27timeout 0
28default 0
29
30label 0
31  LOCALBOOT 0
32'''
33
34for b in BootName.objects.all():
35    if b.available:
36        b.available = False
37        b.save()
38
39for n in list:
40    try:
41        boot_name = BootName.objects.get(name=n)
42        boot_name.available = True
43    except BootName.DoesNotExist:
44        boot_name = BootName(name=n, available=True)
45    print 'registering', boot_name.name
46    boot_name.save()
47   
48# syncbootnames ends here
Note: See TracBrowser for help on using the browser.