~racb/ubuntu/precise/cobbler/858860

« back to all changes in this revision

Viewing changes to cobbler/pxegen.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Clint Byrum, Robie Basak
  • Date: 2011-11-15 12:35:40 UTC
  • mfrom: (1.1.8)
  • Revision ID: package-import@ubuntu.com-20111115123540-5g139uuhg7z0hv5d
Tags: 2.2.2-0ubuntu1
[Chuck Short]
* New upstream release:
  + Use dh_python2 everywhere.
  + Folded debian/patches/49_ubuntu_add_arm_arch_support.patch
    and debian/patches/56_ubuntu_arm_generate_pxe_files.patch
    into one patch for easier upstreaming.
  + Dropped debian/patches/50_fix_cobbler_timezone.patch:
    Fix upstream.
  + Dropped debian/patches/47_ubuntu_add_oneiric_codename.patch
    in favor of debian/patches/47_ubuntu_add_codenames.patch:
    It adds "precise" and drops unsupported releases as well.
  + Dropped debian/patches/41_update_tree_path_with_arch.patch:
    No longer needed.
  + Dropped debian/patches/55_ubuntu_branding.patch: Will be moved
    to orchestra

 [Clint Byrum]
 * debian/cobbler.postinst: create users.digest mode 0600 so it
   is not world readable. (LP: #858860)
 * debian/control: cobbler needs to depend on python-cobbler
   (LP: #863738)
 * debian/patches/58_fix_egg_cache.patch: Do not point dangerous
   PYTHON_EGG_CACHE at world writable directory. (LP: #858875)
 * debian/cobbler-common.install: remove users.digest as it is
   not required and contains a known password that would leave
   cobblerd vulnerable if started before configuration is done
 * debian/cobbler-web.postinst: fix perms on webui_sessions to
   be more secure (LP: #863755)

 [Robie Basak]
 * Backport safe YAML load from upstream. (LP: #858883)

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
import glob
31
31
import traceback
32
32
import errno
33
 
try:
34
 
    import subprocess as sub_process
35
 
except:
36
 
    import sub_process
37
33
import string
38
34
import socket
39
35
 
221
217
            blended = utils.blender(self.api, True, system)
222
218
            self.templar.render(template_cf, blended, cf)
223
219
            # FIXME: profiles also need this data!
224
 
            # FIXME: the _conf and _parm files are limited to 80 characters in length 
225
 
            ipaddress = socket.gethostbyname_ex(blended["http_server"])[2][0]
 
220
            # FIXME: the _conf and _parm files are limited to 80 characters in length
 
221
            try: 
 
222
                ipaddress = socket.gethostbyname_ex(blended["http_server"])[2][0]
 
223
            except socket.gaierror:
 
224
                ipaddress = blended["http_server"]
226
225
            kickstart_path = "http://%s/cblr/svc/op/ks/system/%s" % (ipaddress, system.name)
227
226
            # gather default kernel_options and default kernel_options_s390x
228
227
            kopts = blended.get("kernel_options","")
337
336
                blended = utils.blender(self.api, True, profile)
338
337
                self.templar.render(template_cf, blended, cf)
339
338
                # FIXME: profiles also need this data!
340
 
                # FIXME: the _conf and _parm files are limited to 80 characters in length 
341
 
                ipaddress = socket.gethostbyname_ex(blended["http_server"])[2][0]
 
339
                # FIXME: the _conf and _parm files are limited to 80 characters in length
 
340
                try: 
 
341
                    ipaddress = socket.gethostbyname_ex(blended["http_server"])[2][0]
 
342
                except socket.gaierror:
 
343
                    ipaddress = blended["http_server"]
342
344
                kickstart_path = "http://%s/cblr/svc/op/ks/profile/%s" % (ipaddress, profile.name)
343
345
                # gather default kernel_options and default kernel_options_s390x
344
346
                kopts = blended.get("kernel_options","")
600
602
                    else:
601
603
                        template = os.path.join(self.settings.pxe_template_dir,"pxelocal.template")
602
604
        else:
603
 
            # not a system record, so this is a profile record
604
 
 
 
605
            # not a system record, so this is a profile record or an image
605
606
            if arch.startswith("s390"):
606
607
                template = os.path.join(self.settings.pxe_template_dir,"pxeprofile_s390x.template")
607
608
            if arch.startswith("arm"):
608
609
                template = os.path.join(self.settings.pxe_template_dir,"pxeprofile_arm.template")
609
610
            elif format == "grub":
610
611
                template = os.path.join(self.settings.pxe_template_dir,"grubprofile.template")
611
 
            elif distro.os_version.startswith("esxi"):
 
612
            elif distro and distro.os_version.startswith("esxi"):
612
613
                # ESXi uses a very different pxe method, see comment above in the system section
613
614
                template = os.path.join(self.settings.pxe_template_dir,"pxeprofile_esxi.template")
614
615
            else:
701
702
 
702
703
            # FIXME: need to make shorter rewrite rules for these URLs
703
704
 
704
 
            ipaddress = socket.gethostbyname_ex(blended["http_server"])[2][0]
 
705
            try:
 
706
                ipaddress = socket.gethostbyname_ex(blended["http_server"])[2][0]
 
707
            except socket.gaierror:
 
708
                ipaddress = blended["http_server"]
705
709
            if system is not None and kickstart_path.startswith("/"):
706
710
                kickstart_path = "http://%s/cblr/svc/op/ks/system/%s" % (ipaddress, system.name)
707
711
            elif kickstart_path.startswith("/"):