~racb/ubuntu/precise/cobbler/858860

« back to all changes in this revision

Viewing changes to .pc/47_ubuntu_add_oneiric_codename.patch/cobbler/codes.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:
1
 
 
2
 
"""
3
 
various codes and constants used by Cobbler
4
 
 
5
 
Copyright 2006-2009, Red Hat, Inc
6
 
Michael DeHaan <mdehaan@redhat.com>
7
 
 
8
 
This program is free software; you can redistribute it and/or modify
9
 
it under the terms of the GNU General Public License as published by
10
 
the Free Software Foundation; either version 2 of the License, or
11
 
(at your option) any later version.
12
 
 
13
 
This program is distributed in the hope that it will be useful,
14
 
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 
GNU General Public License for more details.
17
 
 
18
 
You should have received a copy of the GNU General Public License
19
 
along with this program; if not, write to the Free Software
20
 
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21
 
02110-1301  USA
22
 
"""
23
 
 
24
 
import utils
25
 
 
26
 
# OS variants table.  This is a variance of the data from 
27
 
# ls /usr/lib/python2.X/site-packages/virtinst/FullVirtGuest.py
28
 
# but replicated here as we can't assume cobbler is installed on a system with libvirt.
29
 
# in many cases it will not be (i.e. old EL4 server, etc) and we need this info to
30
 
# know how to validate --os-variant and --os-version. 
31
 
#
32
 
# The keys of this hash correspond with the --breed flag in Cobbler.
33
 
# --breed has physical provisioning semantics as well as virt semantics.
34
 
#
35
 
# presense of something in this table does /not/ mean it's supported.
36
 
# for instance, currently, "redhat", "debian", and "suse" do something interesting.
37
 
# the rest are undefined (for now), this will evolve.
38
 
 
39
 
VALID_OS_BREEDS = [
40
 
    "redhat", "debian", "ubuntu", "suse", "generic", "windows", "unix", "vmware", "other"
41
 
]
42
 
 
43
 
VALID_OS_VERSIONS = {
44
 
    "redhat"  : [ "rhel2.1", "rhel3", "rhel4", "rhel5", "rhel6", "fedora5", "fedora6", "fedora7", "fedora8", "fedora9", "fedora10", "fedora11", "fedora12", "fedora13", "fedora14", "generic24", "generic26", "virtio26", "other" ],
45
 
    "suse"    : [ "sles10", "generic24", "generic26", "virtio26", "other" ],
46
 
    "debian"  : [ "etch", "lenny", "squeeze", "sid", "stable", "testing", "unstable", "generic24", "generic26", "other" ],
47
 
    "ubuntu"  : [ "dapper", "hardy", "intrepid", "jaunty", "karmic", "lucid", "maverick", "natty" ],
48
 
    "generic" : [ "generic24", "generic26", "other" ],
49
 
    "windows" : [ "winxp", "win2k", "win2k3", "vista", "other" ],
50
 
    "unix"    : [ "solaris9", "solaris10", "freebsd6", "openbsd4", "other" ],
51
 
    "vmware"  : [ "esx4", "esxi4" ],
52
 
    "other"   : [ "msdos", "netware4", "netware5", "netware6", "generic", "other" ]
53
 
}
54
 
 
55
 
VALID_REPO_BREEDS = [
56
 
    "rsync", "rhn", "yum", "apt"
57
 
#   "rsync", "rhn", "yum"
58
 
]
59
 
 
60
 
def uniquify(seq, idfun=None):
61
 
 
62
 
    # this is odd (older mod_python scoping bug?) but we can't use 
63
 
    # utils.uniquify here because on older distros (RHEL4/5) 
64
 
    # mod_python gets another utils.  As a result,
65
 
    # it is duplicated here for now.  Bad, but ... now you know.
66
 
    #
67
 
    # credit: http://www.peterbe.com/plog/uniqifiers-benchmark
68
 
    # FIXME: if this is actually slower than some other way, overhaul it
69
 
 
70
 
    if idfun is None:
71
 
        def idfun(x):
72
 
           return x
73
 
    seen = {}
74
 
    result = []
75
 
    for item in seq:
76
 
        marker = idfun(item)
77
 
        if marker in seen:
78
 
            continue
79
 
        seen[marker] = 1
80
 
        result.append(item)
81
 
    return result
82
 
 
83
 
 
84
 
def get_all_os_versions():
85
 
   """
86
 
   Collapse the above list of OS versions for usage/display by the CLI/webapp.
87
 
   """
88
 
   results = ['']
89
 
   for x in VALID_OS_VERSIONS.keys():
90
 
      for y in VALID_OS_VERSIONS[x]:
91
 
         results.append(y)
92
 
 
93
 
   results = uniquify(results)
94
 
 
95
 
   results.sort()
96
 
   return results
97
 
 
98