/usr/share/pyshared/cobbler/modules/manage_tftpd_py.py is in python-cobbler 2.2.2-0ubuntu33.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | """
This is some of the code behind 'cobbler sync'.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
"""
import traceback
import errno
import re
import clogger
from shlex import shlex
import utils
from cexceptions import *
import templar
import pxegen
from utils import _
def register():
"""
The mandatory cobbler module registration hook.
"""
return "manage"
class TftpdPyManager:
def what(self):
return "tftpd"
def __init__(self,config,logger):
"""
Constructor
"""
self.logger = logger
if self.logger is None:
self.logger = clogger.Logger()
self.config = config
self.templar = templar.Templar(config)
self.settings_file = "/etc/xinetd.d/tftp"
def regen_hosts(self):
pass # not used
def write_dns_files(self):
pass # not used
def write_boot_files_distro(self,distro):
"""
Copy files in profile["boot_files"] into /tftpboot. Used for vmware
currently.
"""
pass # not used. Handed by tftp.py
def write_boot_files(self):
"""
Copy files in profile["boot_files"] into /tftpboot. Used for vmware
currently.
"""
pass # not used. Handed by tftp.py
def add_single_distro(self,distro):
pass # not used
def write_tftpd_files(self):
"""
xinetd files are written when manage_tftp is set in
/var/lib/cobbler/settings.
"""
template_file = "/etc/cobbler/tftpd.template"
try:
f = open(template_file,"r")
except:
raise CX(_("error reading template %s") % template_file)
template_data = ""
template_data = f.read()
f.close()
metadata = {
"user" : "nobody",
"binary" : "/usr/sbin/tftpd",
"args" : "-v"
}
self.logger.info("generating %s" % self.settings_file)
self.templar.render(template_data, metadata, self.settings_file, None)
def sync(self,verbose=True):
"""
Write out files to /tftpdboot. Mostly unused for the python server
"""
self.logger.info("copying bootloaders")
pxegen.PXEGen(self.config,self.logger).copy_bootloaders()
def update_netboot(self,name):
"""
Write out files to /tftpdboot. Unused for the python server
"""
pass
def add_single_system(self,name):
"""
Write out files to /tftpdboot. Unused for the python server
"""
pass
def get_manager(config,logger):
return TftpdPyManager(config,logger)
|