diff options
author | Michael DeHaan <mdehaan@redhat.com> | 2009-03-12 12:44:56 -0400 |
---|---|---|
committer | Michael DeHaan <mdehaan@redhat.com> | 2009-03-12 12:44:56 -0400 |
commit | 4f8811ab07c65e052a567436a38eca418de3166a (patch) | |
tree | 4e87e367ba88029e27b9fd5a1ac7ae64a61859ae | |
parent | d337d90d42a8852e2b054fbfff170215c2dea45e (diff) | |
parent | 1f005d6bbfddb479007f0108a58968c856ade7a4 (diff) | |
download | cobbler-4f8811ab07c65e052a567436a38eca418de3166a.tar.gz cobbler-4f8811ab07c65e052a567436a38eca418de3166a.tar.xz cobbler-4f8811ab07c65e052a567436a38eca418de3166a.zip |
Merge commit 'jamesc/ris-devel' into devel
-rw-r--r-- | cobbler/action_check.py | 9 | ||||
-rw-r--r-- | cobbler/modules/sync_post_restart_services.py | 25 | ||||
-rw-r--r-- | cobbler/pxegen.py | 156 | ||||
-rw-r--r-- | cobbler/settings.py | 6 | ||||
-rw-r--r-- | setup.py | 2 | ||||
-rw-r--r-- | templates/tftpd-rules.template | 2 |
6 files changed, 33 insertions, 167 deletions
diff --git a/cobbler/action_check.py b/cobbler/action_check.py index 151d0ef9..3cd4a0f8 100644 --- a/cobbler/action_check.py +++ b/cobbler/action_check.py @@ -89,7 +89,6 @@ class BootCheck: self.check_service(status,"smb") self.check_smb_shares(status) self.check_service(status,"ris-linuxd") - self.check_tftpd_rules(status) return status @@ -315,14 +314,14 @@ class BootCheck: using_rules = False f = open(self.settings.tftpd_conf) re_disable = re.compile(r'disable.*=.*yes') - re_rules = re.compile(r'.*-m /etc/tftpd.rules.*') + re_rules = re.compile(r'.*-m %s.*' % self.settings.tftpd_rules) for line in f.readlines(): if re_disable.search(line) and not line.strip().startswith("#"): status.append(_("change 'disable' to 'no' in %(file)s") % { "file" : self.settings.tftpd_conf }) if re_rules.search(line): using_rules = True if not using_rules: - status.append(_("tftpd not configured to use rules. Add '-m /etc/tftpd.rules' to the server_args line")) + status.append(_("tftpd not configured to use rules. Add '-m %s' to the server_args line") % self.settings.tftpd_rules) else: status.append(_("file %(file)s does not exist") % { "file" : self.settings.tftpd_conf }) @@ -331,10 +330,6 @@ class BootCheck: status.append(_("directory needs to be created: %s" % bootloc)) - def check_tftpd_rules(self,status): - if not os.path.exists("/etc/tftpd.rules"): - status.append(_("tftpd rules are missing. Microsoft Windows remote (physical) installations will not work correctly")) - def check_dhcpd_conf(self,status): """ NOTE: this code only applies if cobbler is *NOT* set to generate diff --git a/cobbler/modules/sync_post_restart_services.py b/cobbler/modules/sync_post_restart_services.py index fa9699b9..65bc0282 100644 --- a/cobbler/modules/sync_post_restart_services.py +++ b/cobbler/modules/sync_post_restart_services.py @@ -22,14 +22,16 @@ def run(api,args): settings = api.settings() - manage_dhcp = str(settings.manage_dhcp).lower() - manage_dns = str(settings.manage_dns).lower() - manage_xinetd = str(settings.manage_xinetd).lower() - restart_dhcp = str(settings.restart_dhcp).lower() - restart_dns = str(settings.restart_dns).lower() - restart_xinetd = str(settings.restart_xinetd).lower() - omapi_enabled = str(settings.omapi_enabled).lower() - omapi_port = str(settings.omapi_port).lower() + manage_dhcp = str(settings.manage_dhcp).lower() + manage_dns = str(settings.manage_dns).lower() + manage_ris_linuxd = str(settings.manage_ris_linuxd).lower() + manage_xinetd = str(settings.manage_xinetd).lower() + restart_dhcp = str(settings.restart_dhcp).lower() + restart_dns = str(settings.restart_dns).lower() + restart_ris_linuxd = str(settings.manage_ris_linuxd).lower() + restart_xinetd = str(settings.restart_xinetd).lower() + omapi_enabled = str(settings.omapi_enabled).lower() + omapi_port = str(settings.omapi_port).lower() which_dhcp_module = module_loader.get_module_from_file("dhcp","module",just_name=True).strip() which_dns_module = module_loader.get_module_from_file("dns","module",just_name=True).strip() @@ -65,6 +67,13 @@ def run(api,args): if manage_xinetd != "0" and restart_xinetd != "0": rc = os.system("/sbin/service xinetd restart") + if rc != 0: + print "- error: service xinetd restart failed" + + if manage_ris_linuxd != "0" and restart_ris_linuxd != "0": + rc = os.system("/sbin/service ris-linuxd restart") + if rc != 0: + print "- error: service ris-linuxd restart failed" return rc diff --git a/cobbler/pxegen.py b/cobbler/pxegen.py index 7ff07808..0dea5f13 100644 --- a/cobbler/pxegen.py +++ b/cobbler/pxegen.py @@ -177,14 +177,14 @@ class PXEGen: return True def generate_windows_files(self): - utils.mkdir("/tftpboot/profiles") + utils.mkdir(os.path.join(self.bootloc, "profiles")) for p in self.profiles: distro = p.get_conceptual_parent() if distro and distro.breed != "windows": continue else: self.generate_windows_profile_pxe(p) - utils.mkdir("/tftpboot/systems") + utils.mkdir(os.path.join(self.bootloc, "systems")) for s in self.systems: profile = s.get_conceptual_parent() if profile: @@ -197,7 +197,7 @@ class PXEGen: def generate_windows_profile_pxe(self, profile): distro = profile.get_conceptual_parent() - dest_dir = os.path.join("/tftpboot/profiles", profile.name) + dest_dir = os.path.join(self.bootloc, "profiles", profile.name) utils.mkdir(dest_dir) utils.cabextract(distro.kernel, dest_dir, self.api) @@ -245,7 +245,7 @@ class PXEGen: data = self.templar.render(template_data, blended, None) - # write .sif to /tftpboot/profiles/$name/winnt.sif + # write .sif to self.bootloc/profiles/$name/winnt.sif file_name = os.path.join(dest_dir, "winnt.sif") fd = open(file_name, "w") fd.write(data) @@ -260,7 +260,7 @@ class PXEGen: distro = profile.get_conceptual_parent() - dest_dir = os.path.join("/tftpboot/systems", system.name) + dest_dir = os.path.join(self.bootloc, "systems", system.name) utils.mkdir(dest_dir) utils.cabextract(distro.kernel, dest_dir, self.api) @@ -311,151 +311,7 @@ class PXEGen: data = self.templar.render(template_data, blended, None) - # write .sif to /tftpboot/systems/$name/winnt.sif - file_name = os.path.join(dest_dir, "winnt.sif") - fd = open(file_name, "w") - fd.write(data) - fd.close() - - return True - - def generate_windows_files(self): - # FIXME: hard coding of /tftpboot here is wrong - utils.mkdir("/tftpboot/profiles") - for p in self.profiles: - distro = p.get_conceptual_parent() - if distro and distro.breed != "windows": - continue - else: - self.generate_windows_profile_pxe(p) - utils.mkdir("/tftpboot/systems") - for s in self.systems: - profile = s.get_conceptual_parent() - if profile: - distro = profile.get_conceptual_parent() - if distro and distro.breed != "windows": - continue - else: - self.generate_windows_system_pxe(s) - - def generate_windows_profile_pxe(self, profile): - distro = profile.get_conceptual_parent() - - dest_dir = os.path.join("/tftpboot/profiles", profile.name) - utils.mkdir(dest_dir) - - utils.cabextract(distro.kernel, dest_dir, self.api) - - src_file = os.path.join(dest_dir, "startrom.n12") - dest_file = os.path.join(dest_dir, "winpxe.0") - cmd = [ "/bin/sed", "-i", "-e", "s/ntldr/L%s/gi" % profile.random_id, src_file ] - sub_process.call(cmd, shell=False, close_fds=False) - os.rename(src_file, dest_file) - - utils.cabextract(distro.initrd, dest_dir, self.api) - - src_file = os.path.join(dest_dir, "setupldr.exe") - dest_file = os.path.join(dest_dir, "NTLDR") - cmd = [ "/bin/sed", "-i", "-e", "s/winnt\\.sif/w%s.sif/gi" % profile.random_id, src_file ] - sub_process.call(cmd, shell=False, close_fds=False) - cmd = [ "/bin/sed", "-i", "-e", "s/ntdetect\\.com/ntd_%s.com/gi" % profile.random_id, src_file ] - sub_process.call(cmd, shell=False, close_fds=False) - os.rename(src_file, dest_file) - - src_dir = os.path.dirname(distro.kernel) - src_file = os.path.join(src_dir, "ntdetect.com") - file_name = os.path.join(dest_dir, "ntdetect.com") - utils.copyfile(src_file, file_name, self.api) - - template = profile.kickstart - fd = open(template, "r") - template_data = fd.read() - fd.close() - - blended = utils.blender(self.api, False, profile) - blended['next_server'] = self.settings.next_server - - ksmeta = blended.get("ks_meta",{}) - del blended["ks_meta"] - blended.update(ksmeta) # make available at top level - - # this is a workaround for a dumb bug in cheetah... - # a backslash before a variable is always treated as - # escaping the $, so things are not rendered correctly. - # The only option is to use another variable for - # backslashes when leading another variable. i.e.: - # \\$variable - blended['bsp'] = '\\' - - data = self.templar.render(template_data, blended, None) - - # write .sif to /tftpboot/profiles/$name/winnt.sif - file_name = os.path.join(dest_dir, "winnt.sif") - fd = open(file_name, "w") - fd.write(data) - fd.close() - - return True - - def generate_windows_system_pxe(self, system): - profile = system.get_conceptual_parent() - if not profile: - return False - - distro = profile.get_conceptual_parent() - - dest_dir = os.path.join("/tftpboot/systems", system.name) - utils.mkdir(dest_dir) - - utils.cabextract(distro.kernel, dest_dir, self.api) - - src_file = os.path.join(dest_dir, "startrom.n12") - dest_file = os.path.join(dest_dir, "winpxe.0") - cmd = [ "/bin/sed", "-i", "-e", "s/ntldr/L%s/gi" % system.random_id, src_file ] - sub_process.call(cmd, shell=False, close_fds=False) - os.rename(src_file, dest_file) - - utils.cabextract(distro.initrd, dest_dir, self.api) - - src_file = os.path.join(dest_dir, "setupldr.exe") - dest_file = os.path.join(dest_dir, "NTLDR") - cmd = [ "/bin/sed", "-i", "-e", "s/winnt\\.sif/w%s.sif/gi" % system.random_id, src_file ] - sub_process.call(cmd, shell=False, close_fds=False) - cmd = [ "/bin/sed", "-i", "-e", "s/ntdetect\\.com/ntd_%s.com/gi" % system.random_id, src_file ] - sub_process.call(cmd, shell=False, close_fds=False) - os.rename(src_file, dest_file) - - src_dir = os.path.dirname(distro.kernel) - src_file = os.path.join(src_dir, "ntdetect.com") - file_name = os.path.join(dest_dir, "ntdetect.com") - utils.copyfile(src_file, file_name, self.api) - - template = system.kickstart - if template == "<<inherit>>": - template = profile.kickstart - - fd = open(template, "r") - template_data = fd.read() - fd.close() - - blended = utils.blender(self.api, False, system) - blended['next_server'] = self.settings.next_server - - ksmeta = blended.get("ks_meta",{}) - del blended["ks_meta"] - blended.update(ksmeta) # make available at top level - - # this is a workaround for a dumb bug in cheetah... - # a backslash before a variable is always treated as - # escaping the $, so things are not rendered correctly. - # The only option is to use another variable for - # backslashes when leading another variable. i.e.: - # \\$variable - blended['bsp'] = '\\' - - data = self.templar.render(template_data, blended, None) - - # write .sif to /tftpboot/systems/$name/winnt.sif + # write .sif to self.bootloc/systems/$name/winnt.sif file_name = os.path.join(dest_dir, "winnt.sif") fd = open(file_name, "w") fd.write(data) diff --git a/cobbler/settings.py b/cobbler/settings.py index ce49d9c8..2422341a 100644 --- a/cobbler/settings.py +++ b/cobbler/settings.py @@ -78,6 +78,7 @@ DEFAULTS = { "kernel_options_s390x" : {}, "manage_dhcp" : 0, "manage_dns" : 0, + "manage_ris_linuxd" : 0, "manage_xinetd" : 0, "manage_forward_zones" : [], "manage_reverse_zones" : [], @@ -99,7 +100,10 @@ DEFAULTS = { "register_new_installs" : 0, "restart_dns" : 1, "restart_dhcp" : 1, + "restart_ris_linuxd" : 1, "restart_xinetd" : 1, + "ris_linuxd_dir" : "/tftpboot/drivers", + "ris_linuxd_flags" : "", "run_install_triggers" : 1, "scm_track_enabled" : 0, "scm_track_mode" : "git", @@ -107,7 +111,7 @@ DEFAULTS = { "snippetsdir" : "/var/lib/cobbler/snippets", "tftpd_bin" : "/usr/sbin/in.tftpd", "tftpd_conf" : "/etc/xinetd.d/tftp", - "tftpd_rules" : "/etc/tftpd.rules", + "tftpd_rules" : "/var/lib/cobbler/cobbler-tftpd.rules", "vsftpd_bin" : "/usr/sbin/vsftpd", "webdir" : "/var/www/cobbler", "xmlrpc_port" : 25151, @@ -208,6 +208,8 @@ if __name__ == "__main__": (pxepath, ['templates/pxeprofile.template']), (pxepath, ['templates/pxelocal.template']), (pxepath, ['templates/pxelocal_s390x.template']), + (pxepath, ['templates/pxeprofile_win.template']), + (pxepath, ['templates/pxesystem_win.template']), # templates for power management (powerpath, ['templates/power_apc_snmp.template']), diff --git a/templates/tftpd-rules.template b/templates/tftpd-rules.template index 2c22b01c..74c4c25f 100644 --- a/templates/tftpd-rules.template +++ b/templates/tftpd-rules.template @@ -1,6 +1,6 @@ # TFTP rules to: # - Convert backslashes to forward slashes -# - Convert everything under /winos/*/* to upper-case +# - Convert everything to upper-case rg \\ / # Convert backslashes to slashes r (.*/i386/)(.*) \1\L\2 |