From 9cd344436b96f4c1f008b17656e0f62eae37c77d Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Thu, 26 Mar 2009 14:36:15 -0500 Subject: [PATCH] Cleanup to remove windows code --- cobbler/action_import.py | 104 +------------------------ cobbler/modules/sync_post_restart_services.py | 14 ---- cobbler/pxegen.py | 80 ------------------- kickstarts/winxp-default.sif | 79 ------------------- setup.py | 3 - templates/pxeprofile_win.template | 2 - templates/pxesystem_win.template | 4 - templates/tftpd.template | 18 ---- 8 files changed, 1 insertions(+), 303 deletions(-) delete mode 100644 kickstarts/winxp-default.sif delete mode 100644 templates/pxeprofile_win.template delete mode 100644 templates/pxesystem_win.template delete mode 100644 templates/tftpd.template diff --git a/cobbler/action_import.py b/cobbler/action_import.py index 378419d..c7b7301 100644 --- a/cobbler/action_import.py +++ b/cobbler/action_import.py @@ -525,10 +525,6 @@ class Importer: if ( x.startswith("vmlinu") or x.startswith("kernel.img") or x.startswith("linux") ) and x.find("initrd") == -1: kernel = os.path.join(dirname,x) - if x.lower().startswith("startrom.n1_"): - startrom = os.path.join(dirname,x) - if x.lower().startswith("setupldr.ex_"): - setupldr = os.path.join(dirname,x) if initrd is not None and kernel is not None and dirname.find("isolinux") == -1: adtl = self.add_entry(dirname,kernel,initrd) if adtl != None: @@ -536,10 +532,6 @@ class Importer: # Not resetting these values causes problems importing debian media because there are remaining items in fnames initrd = None kernel = None - elif startrom is not None and setupldr is not None: - self.add_win_entry(dirname,startrom,setupldr) - startrom = None - setupldr = None # ======================================================================== @@ -676,100 +668,6 @@ class Importer: # ======================================================================== - def add_win_entry(self, dirname, startrom, setupldr): - - proposed_name = self.get_proposed_name(dirname) - proposed_arch = self.get_proposed_arch(dirname) - if self.arch and proposed_arch and self.arch != proposed_arch: - raise CX(_("Arch from pathname (%s) does not match with supplied one %s")%(proposed_arch,self.arch)) - - importer = import_factory(dirname,self.path,self.breed) - - #archs = importer.learn_arch_from_tree() - #if self.arch and self.arch not in archs: - # raise CX(_("Given arch (%s) not found on imported tree %s")%(self.arch,importer.get_pkgdir())) - #if proposed_arch: - # if proposed_arch not in archs: - # print _("Warning: arch from pathname (%s) not found on imported tree %s") % (proposed_arch,importer.get_pkgdir()) - # return - # - # archs = [ proposed_arch ] - - archs = [ proposed_arch ] - - if len(archs)>1: - print _("- Warning : Multiple archs found : %s") % (archs) - - distros_added = [] - - for pxe_arch in archs: - - name = proposed_name + "-" + pxe_arch - existing_distro = self.distros.find(name=name) - - if existing_distro is not None: - print _("- warning: skipping import, as distro name already exists: %s") % name - continue - - else: - print _("- creating new distro: %s") % name - distro = self.config.new_distro() - - distro.set_name(name) - distro.set_kernel(startrom) - distro.set_initrd(setupldr) - distro.set_arch(pxe_arch) - distro.set_breed(importer.breed) - distro.source_repos = [] - - # Create the directory in bootloc to bind-mount to - # and excute the bind-mount there - tld = os.path.normpath(os.path.join(dirname,'..')) - utils.mkdir(os.path.join(utils.tftpboot_location(),name)) - utils.bindmount(tld, os.path.join(utils.tftpboot_location(),name)) - - # Create the directories for extra OEM drivers - # $oem$/$1/Drivers/NIC - # /Video - # /Sound - # /Other - utils.mkdir(os.path.join(tld,'$oem$','$1','Drivers','NIC')) - utils.mkdir(os.path.join(tld,'$oem$','$1','Drivers','Video')) - utils.mkdir(os.path.join(tld,'$oem$','$1','Drivers','Sound')) - utils.mkdir(os.path.join(tld,'$oem$','$1','Drivers','Other')) - - self.distros.add(distro,save=True) - distros_added.append(distro) - - existing_profile = self.profiles.find(name=name) - - # see if the profile name is already used, if so, skip it and - # do not modify the existing profile - - if existing_profile is None: - print _("- creating new profile: %s") % name - profile = self.config.new_profile() - else: - print _("- skipping existing profile, name already exists: %s") % name - continue - - # save our minimal profile which just points to the distribution and a good - # default answer file - - profile.set_name(name) - profile.set_distro(name) - if self.kickstart_file: - profile.set_kickstart(self.kickstart_file) - - # save our new profile to the collection - - self.profiles.add(profile,save=True) - - self.api.serialize() - return distros_added - - # ======================================================================== - def get_proposed_name(self,dirname): """ @@ -1027,7 +925,7 @@ class RedHatImporter ( BaseImporter ) : def __init__(self,(rootdir,pkgdir)): self.breed = "redhat" - self.ks = "/var/lib/cobbler/default.ks" + self.ks = "/var/lib/cobbler/kickstarts/default.ks" self.rootdir = rootdir self.pkgdir = pkgdir diff --git a/cobbler/modules/sync_post_restart_services.py b/cobbler/modules/sync_post_restart_services.py index 8d3fe9b..8bf3107 100644 --- a/cobbler/modules/sync_post_restart_services.py +++ b/cobbler/modules/sync_post_restart_services.py @@ -24,13 +24,9 @@ def run(api,args): 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_bin = str(settings.restart_bin).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() dhcpd_bin = str(settings.dhcpd_bin).lower() dhcpd_init = str(settings.dhcpd_init).lower() omapi_enabled = str(settings.omapi_enabled).lower() @@ -68,15 +64,5 @@ def run(api,args): print "- error: unknown DNS engine: %s" % which_dns_module rc = 412 - 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 536e61a..8a98b0e 100644 --- a/cobbler/pxegen.py +++ b/cobbler/pxegen.py @@ -112,9 +112,6 @@ class PXEGen: """ errors = list() for d in self.distros: - # we don't copy the files for windows distros - if d.breed == "windows": - continue try: if self.verbose: print "- copying files for distro: %s" % d.name @@ -176,83 +173,6 @@ class PXEGen: utils.linkfile(filename, newfile, api=self.api, verbose=self.verbose) return True - def generate_windows_files(self): - 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(os.path.join(self.bootloc, "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(self.bootloc, "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 self.bootloc/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 write_all_system_files(self,system): profile = system.get_conceptual_parent() diff --git a/kickstarts/winxp-default.sif b/kickstarts/winxp-default.sif deleted file mode 100644 index 7d99305..0000000 --- a/kickstarts/winxp-default.sif +++ /dev/null @@ -1,79 +0,0 @@ -#set $product_key = $getVar('product_key','') - -; More options can be found here -; http://unattended.msfn.org/unattended.xp/view/web/19/ - -[data] -floppyless = "1" -msdosinitiated = "1" -; Needed for second stage -OriSrc = "${bsp}${bsp}$next_server\REMINST${bsp}$name\i386" -OriTyp = "4" -LocalSourceOnCD = 1 -;DisableAdminAccountOnDomainJoin = 1 -;AutoPartition = 1 -UnattendedInstall="Yes" - -[SetupData] -OsLoadOptions = "/noguiboot /fastdetect" -; Needed for first stage -SetupSourceDevice = "\Device\LanmanRedirector${bsp}$next_server\REMINST${bsp}$name" - -[Unattended] -OemPreinstall = yes -OemPnPDriversPath = Drivers\NIC; -TargetPath = \WINDOWS -UnattendMode=FullUnattended -UnattendSwitch = yes -WaitForReboot = no -OemSkipEula = yes -InstallFilesPath = "\\%SERVERNAME%\REMINST\%INSTALLPATH%\%MACHINETYPE%" -LegacyNIC = 1 -;new -OverwriteOemFilesOnupgrade=No -DriverSigningPolicy=Ignore -ConfirmHardware=No - -[UserData] -ComputerName = $name -; if needed -#if $product_key -ProductID = $product_key -#else -# ProductID = -#end if -FullName = "Your Name" -OrgName = "Your Organization" - -[RemoteInstall] -Repartition = Yes -UseWholeDisk = Yes - -[GuiUnattended] -OemSkipWelcome = 1 -OemSkipRegional = 1 -TimeZone = 110 -AdminPassword = "password" -EncryptedAdminPassword=no -AutoLogon=Yes -AutoLogonCount=1 - -[Display] -ConfigureAtLogon = 0 -BitsPerPel = 16 -XResolution = 1024 -YResolution = 768 -VRefresh = 72 -AutoConfirm = 1 - -[Identification] -JoinWorkgroup=WORKGROUP - -[Networking] -InstallDefaultComponents=Yes - -[Components] -msmsgs=off - -[Shell] -DefaultStartPanelOff = No diff --git a/setup.py b/setup.py index 99636c5..135b8af 100644 --- a/setup.py +++ b/setup.py @@ -196,7 +196,6 @@ if __name__ == "__main__": (etcpath, ['templates/dnsmasq.template']), (etcpath, ['templates/named.template']), (etcpath, ['templates/zone.template']), - (etcpath, ['templates/tftpd.template']), # templates for netboot configs (pxepath, ['templates/pxedefault.template']), @@ -210,8 +209,6 @@ 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/pxeprofile_win.template b/templates/pxeprofile_win.template deleted file mode 100644 index 6cb8e88..0000000 --- a/templates/pxeprofile_win.template +++ /dev/null @@ -1,2 +0,0 @@ -label $profile_name - kernel $kernel_path diff --git a/templates/pxesystem_win.template b/templates/pxesystem_win.template deleted file mode 100644 index 28c1b6f..0000000 --- a/templates/pxesystem_win.template +++ /dev/null @@ -1,4 +0,0 @@ -prompt 0 -timeout 1 -label $system_name - kernel $kernel_path diff --git a/templates/tftpd.template b/templates/tftpd.template deleted file mode 100644 index bd54502..0000000 --- a/templates/tftpd.template +++ /dev/null @@ -1,18 +0,0 @@ -# default: off -# description: The tftp server serves files using the trivial file transfer \ -# protocol. The tftp protocol is often used to boot diskless \ -# workstations, download configuration files to network-aware printers, \ -# and to start the installation process for some operating systems. -service tftp -{ - disable = no - socket_type = dgram - protocol = udp - wait = yes - user = root - server = /usr/sbin/in.tftpd - server_args = -p -s /tftpboot -m /etc/tftpd.rules -v - per_source = 11 - cps = 100 2 - flags = IPv4 -} -- 1.5.5.1