1
Description: 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
5
Author: Andres Rodriguez <andreserl@ubuntu.com>
6
Bug: https://bugs.launchpad.net/ubuntu/+source/cobbler/+bug/731620
7
Index: 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
18
import simplejson as json
19
-sys.path.append('/usr/share/yum-cli')
24
+ sys.path.append('/usr/share/yum-cli')
26
+ yum_available = True
28
+ yum_available = False
33
"""Constructor. Requires json config object."""
34
self.config = json.JSONDecoder().decode(config)
36
+ self.dist = utils.check_dist()
38
#----------------------------------------------------------------------
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()
45
+ def configure_yum_repos(self):
46
"""Configure YUM repositories."""
47
print "- Configuring Repos"
48
old_repo = '/etc/yum.repos.d/config.repo'
50
#----------------------------------------------------------------------
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()
57
+ def configure_yum_packages(self):
58
"""Configure package resources."""
59
print "- Configuring Packages"
60
runtime_start = time.time()