3
various codes and constants used by Cobbler
5
Copyright 2006-2009, Red Hat, Inc
6
Michael DeHaan <mdehaan@redhat.com>
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.
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.
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
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.
32
# The keys of this hash correspond with the --breed flag in Cobbler.
33
# --breed has physical provisioning semantics as well as virt semantics.
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.
40
"redhat", "debian", "ubuntu", "suse", "generic", "windows", "unix", "vmware", "other"
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" ]
56
"rsync", "rhn", "yum", "apt"
57
# "rsync", "rhn", "yum"
60
def uniquify(seq, idfun=None):
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.
67
# credit: http://www.peterbe.com/plog/uniqifiers-benchmark
68
# FIXME: if this is actually slower than some other way, overhaul it
84
def get_all_os_versions():
86
Collapse the above list of OS versions for usage/display by the CLI/webapp.
89
for x in VALID_OS_VERSIONS.keys():
90
for y in VALID_OS_VERSIONS[x]:
93
results = uniquify(results)