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
=== modified file 'debian/changelog'
--- debian/changelog 2011-03-11 13:19:48 +0000
+++ debian/changelog 2011-03-11 21:12:59 +0000
@@ -1,3 +1,12 @@
1cobbler (2.1.0~bzr2005-0ubuntu2) natty; urgency=low
2
3 * debian/patches/31_add_ubuntu_koan_utils_support.patch: Add support for
4 ubuntu distro in koan utils.py.
5 * debian/patches/32_fix_koan_import_yum.patch: Fix import error of yum
6 python module; adds flexibility for other package managers. (LP: #731620)
7
8 -- Andres Rodriguez <andreserl@ubuntu.com> Fri, 11 Mar 2011 16:02:48 -0500
9
1cobbler (2.1.0~bzr2005-0ubuntu1) natty; urgency=low10cobbler (2.1.0~bzr2005-0ubuntu1) natty; urgency=low
211
3 [Chuck Short]12 [Chuck Short]
413
=== added file 'debian/patches/31_add_ubuntu_koan_utils_support.patch'
--- debian/patches/31_add_ubuntu_koan_utils_support.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/31_add_ubuntu_koan_utils_support.patch 2011-03-11 21:12:59 +0000
@@ -0,0 +1,35 @@
1Description: Add support for Ubuntu distro
2 Taken from cobbler utils.py
3Author: Andres Rodriguez <andreserl@ubuntu.com>
4Index: ubuntu/koan/utils.py
5===================================================================
6--- ubuntu.orig/koan/utils.py 2011-03-11 16:02:47.221564016 -0500
7+++ ubuntu/koan/utils.py 2011-03-11 16:02:42.831557582 -0500
8@@ -315,7 +315,8 @@
9 Determines what distro we're running under.
10 """
11 if os.path.exists("/etc/debian_version"):
12- return "debian"
13+ import lsb_release
14+ return lsb_release.get_distro_information()['ID'].lower()
15 elif os.path.exists("/etc/SuSE-release"):
16 return "suse"
17 else:
18@@ -351,11 +352,12 @@
19 raise CX("failed to detect local OS version from /etc/redhat-release")
20
21 elif check_dist() == "debian":
22- fd = open("/etc/debian_version")
23- parts = fd.read().split(".")
24- version = parts[0]
25- rest = parts[1]
26- make = "debian"
27+ import lsb_release
28+ release = lsb_release.get_distro_information()['RELEASE']
29+ return ("debian", release)
30+ elif check_dist() == "ubuntu":
31+ version = sub_process.check_output(("lsb_release","--release","--short")).rstrip()
32+ make = "ubuntu"
33 return (make, float(version))
34 elif check_dist() == "suse":
35 fd = open("/etc/SuSE-release")
036
=== added file 'debian/patches/32_fix_koan_import_yum.patch'
--- debian/patches/32_fix_koan_import_yum.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/32_fix_koan_import_yum.patch 2011-03-11 21:12:59 +0000
@@ -0,0 +1,60 @@
1Description: Do not fail when yum python module is not present.
2 Since ubuntu does not use yum, this fixes the failure of importing
3 the yum python module and adding support to be able to use other
4 package managers in the future
5Author: Andres Rodriguez <andreserl@ubuntu.com>
6Bug: https://bugs.launchpad.net/ubuntu/+source/cobbler/+bug/731620
7Index: ubuntu/koan/configurator.py
8===================================================================
9--- ubuntu.orig/koan/configurator.py 2011-03-11 16:03:32.531630478 -0500
10+++ ubuntu/koan/configurator.py 2011-03-11 16:03:27.321622833 -0500
11@@ -31,13 +31,16 @@
12 import os.path
13 import sys
14 import time
15-import yum
16 import pwd
17 import grp
18 import simplejson as json
19-sys.path.append('/usr/share/yum-cli')
20-import cli
21-
22+try:
23+ import yum
24+ sys.path.append('/usr/share/yum-cli')
25+ import cli
26+ yum_available = True
27+except:
28+ yum_available = False
29
30 class KoanConfigure:
31 """
32@@ -49,10 +52,16 @@
33 """Constructor. Requires json config object."""
34 self.config = json.JSONDecoder().decode(config)
35 self.stats = {}
36+ self.dist = utils.check_dist()
37
38 #----------------------------------------------------------------------
39
40 def configure_repos(self):
41+ # Enables the possibility to use different types of repos
42+ if yum_available and self.dist == "redhat":
43+ self.configure_yum_repos()
44+
45+ def configure_yum_repos(self):
46 """Configure YUM repositories."""
47 print "- Configuring Repos"
48 old_repo = '/etc/yum.repos.d/config.repo'
49@@ -108,6 +117,11 @@
50 #----------------------------------------------------------------------
51
52 def configure_packages(self):
53+ # Enables the possibility to use different types of package configurators
54+ if yum_available and self.dist == "redhat":
55+ self.configure_yum_packages()
56+
57+ def configure_yum_packages(self):
58 """Configure package resources."""
59 print "- Configuring Packages"
60 runtime_start = time.time()
061
=== modified file 'debian/patches/series'
--- debian/patches/series 2011-02-18 18:15:44 +0000
+++ debian/patches/series 2011-03-11 21:12:59 +0000
@@ -2,3 +2,5 @@
230_cobbler4j_redstone.patch230_cobbler4j_redstone.patch
312_fix_dhcp_restart.patch312_fix_dhcp_restart.patch
405_cobbler_fix_reposync_permissions.patch405_cobbler_fix_reposync_permissions.patch
531_add_ubuntu_koan_utils_support.patch
632_fix_koan_import_yum.patch

Subscribers

People subscribed via source and target branches