Merge lp:~andreserl/ubuntu/natty/cobbler/lp731620 into lp:~ubuntu-virt/cobbler/ubuntu

Proposed by Andres Rodriguez
Status: Merged
Merged at revision: 2007
Proposed branch: lp:~andreserl/ubuntu/natty/cobbler/lp731620
Merge into: lp:~ubuntu-virt/cobbler/ubuntu
Diff against target: 131 lines (+106/-0)
4 files modified
debian/changelog (+9/-0)
debian/patches/31_add_ubuntu_koan_utils_support.patch (+35/-0)
debian/patches/32_fix_koan_import_yum.patch (+60/-0)
debian/patches/series (+2/-0)
To merge this branch: bzr merge lp:~andreserl/ubuntu/natty/cobbler/lp731620
Reviewer Review Type Date Requested Status
Chuck Short Pending
Review via email: mp+53092@code.launchpad.net

This proposal supersedes a proposal from 2011-03-11.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2011-03-11 13:19:48 +0000
3+++ debian/changelog 2011-03-11 21:12:59 +0000
4@@ -1,3 +1,12 @@
5+cobbler (2.1.0~bzr2005-0ubuntu2) natty; urgency=low
6+
7+ * debian/patches/31_add_ubuntu_koan_utils_support.patch: Add support for
8+ ubuntu distro in koan utils.py.
9+ * debian/patches/32_fix_koan_import_yum.patch: Fix import error of yum
10+ python module; adds flexibility for other package managers. (LP: #731620)
11+
12+ -- Andres Rodriguez <andreserl@ubuntu.com> Fri, 11 Mar 2011 16:02:48 -0500
13+
14 cobbler (2.1.0~bzr2005-0ubuntu1) natty; urgency=low
15
16 [Chuck Short]
17
18=== added file 'debian/patches/31_add_ubuntu_koan_utils_support.patch'
19--- debian/patches/31_add_ubuntu_koan_utils_support.patch 1970-01-01 00:00:00 +0000
20+++ debian/patches/31_add_ubuntu_koan_utils_support.patch 2011-03-11 21:12:59 +0000
21@@ -0,0 +1,35 @@
22+Description: Add support for Ubuntu distro
23+ Taken from cobbler utils.py
24+Author: Andres Rodriguez <andreserl@ubuntu.com>
25+Index: ubuntu/koan/utils.py
26+===================================================================
27+--- ubuntu.orig/koan/utils.py 2011-03-11 16:02:47.221564016 -0500
28++++ ubuntu/koan/utils.py 2011-03-11 16:02:42.831557582 -0500
29+@@ -315,7 +315,8 @@
30+ Determines what distro we're running under.
31+ """
32+ if os.path.exists("/etc/debian_version"):
33+- return "debian"
34++ import lsb_release
35++ return lsb_release.get_distro_information()['ID'].lower()
36+ elif os.path.exists("/etc/SuSE-release"):
37+ return "suse"
38+ else:
39+@@ -351,11 +352,12 @@
40+ raise CX("failed to detect local OS version from /etc/redhat-release")
41+
42+ elif check_dist() == "debian":
43+- fd = open("/etc/debian_version")
44+- parts = fd.read().split(".")
45+- version = parts[0]
46+- rest = parts[1]
47+- make = "debian"
48++ import lsb_release
49++ release = lsb_release.get_distro_information()['RELEASE']
50++ return ("debian", release)
51++ elif check_dist() == "ubuntu":
52++ version = sub_process.check_output(("lsb_release","--release","--short")).rstrip()
53++ make = "ubuntu"
54+ return (make, float(version))
55+ elif check_dist() == "suse":
56+ fd = open("/etc/SuSE-release")
57
58=== added file 'debian/patches/32_fix_koan_import_yum.patch'
59--- debian/patches/32_fix_koan_import_yum.patch 1970-01-01 00:00:00 +0000
60+++ debian/patches/32_fix_koan_import_yum.patch 2011-03-11 21:12:59 +0000
61@@ -0,0 +1,60 @@
62+Description: Do not fail when yum python module is not present.
63+ Since ubuntu does not use yum, this fixes the failure of importing
64+ the yum python module and adding support to be able to use other
65+ package managers in the future
66+Author: Andres Rodriguez <andreserl@ubuntu.com>
67+Bug: https://bugs.launchpad.net/ubuntu/+source/cobbler/+bug/731620
68+Index: ubuntu/koan/configurator.py
69+===================================================================
70+--- ubuntu.orig/koan/configurator.py 2011-03-11 16:03:32.531630478 -0500
71++++ ubuntu/koan/configurator.py 2011-03-11 16:03:27.321622833 -0500
72+@@ -31,13 +31,16 @@
73+ import os.path
74+ import sys
75+ import time
76+-import yum
77+ import pwd
78+ import grp
79+ import simplejson as json
80+-sys.path.append('/usr/share/yum-cli')
81+-import cli
82+-
83++try:
84++ import yum
85++ sys.path.append('/usr/share/yum-cli')
86++ import cli
87++ yum_available = True
88++except:
89++ yum_available = False
90+
91+ class KoanConfigure:
92+ """
93+@@ -49,10 +52,16 @@
94+ """Constructor. Requires json config object."""
95+ self.config = json.JSONDecoder().decode(config)
96+ self.stats = {}
97++ self.dist = utils.check_dist()
98+
99+ #----------------------------------------------------------------------
100+
101+ def configure_repos(self):
102++ # Enables the possibility to use different types of repos
103++ if yum_available and self.dist == "redhat":
104++ self.configure_yum_repos()
105++
106++ def configure_yum_repos(self):
107+ """Configure YUM repositories."""
108+ print "- Configuring Repos"
109+ old_repo = '/etc/yum.repos.d/config.repo'
110+@@ -108,6 +117,11 @@
111+ #----------------------------------------------------------------------
112+
113+ def configure_packages(self):
114++ # Enables the possibility to use different types of package configurators
115++ if yum_available and self.dist == "redhat":
116++ self.configure_yum_packages()
117++
118++ def configure_yum_packages(self):
119+ """Configure package resources."""
120+ print "- Configuring Packages"
121+ runtime_start = time.time()
122
123=== modified file 'debian/patches/series'
124--- debian/patches/series 2011-02-18 18:15:44 +0000
125+++ debian/patches/series 2011-03-11 21:12:59 +0000
126@@ -2,3 +2,5 @@
127 30_cobbler4j_redstone.patch
128 12_fix_dhcp_restart.patch
129 05_cobbler_fix_reposync_permissions.patch
130+31_add_ubuntu_koan_utils_support.patch
131+32_fix_koan_import_yum.patch

Subscribers

People subscribed via source and target branches