summaryrefslogtreecommitdiffstats
path: root/util.py
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2006-04-05 11:59:27 -0400
committerJim Meyering <jim@meyering.net>2006-04-05 11:59:27 -0400
commit5b0f54d5674a1b47c112342994b6f0bae6172809 (patch)
tree30f90a213ccdaf6881525d027b1b587393c956bd /util.py
parent975fc8a2d6183345061b20988f160df3bed60dd2 (diff)
downloadthird_party-cobbler-5b0f54d5674a1b47c112342994b6f0bae6172809.tar.gz
third_party-cobbler-5b0f54d5674a1b47c112342994b6f0bae6172809.tar.xz
third_party-cobbler-5b0f54d5674a1b47c112342994b6f0bae6172809.zip
Added dry-run support. Pre-refactoring cleanup. Moved config file to /etc.
Diffstat (limited to 'util.py')
-rw-r--r--util.py41
1 files changed, 14 insertions, 27 deletions
diff --git a/util.py b/util.py
index c990461..f5450e4 100644
--- a/util.py
+++ b/util.py
@@ -9,26 +9,8 @@ import re
import socket
import glob
-# FIXME: use python logging?
-
-def debug(msg):
- print "debug: %s" % msg
-
-def info(msg):
- print "%s" % msg
-
-def error(msg):
- print "error: %s" % msg
-
-def warning(msg):
- print "warning: %s" % msg
-
class BootUtil:
-
- # TO DO: functions for manipulation of all things important.
- # yes, that's a lot...
-
def __init__(self,api,config):
self.api = api
self.config = config
@@ -114,7 +96,11 @@ class BootUtil:
if os.path.exists(last_chance):
return last_chance
return None
-
+
+ """
+ Given a directory or a filename, find if the path can be made
+ to resolve into a kernel, and return that full path if possible.
+ """
def find_kernel(self,path):
if os.path.isfile(path):
filename = os.path.basename(path)
@@ -126,8 +112,12 @@ class BootUtil:
return self.find_highest_files(path,"vmlinuz",self.re_kernel)
return None
+ """
+ Given a directory or a filename, see if the path can be made
+ to resolve into an intird, return that full path if possible.
+ """
def find_initrd(self,path):
- # FUTURE: add another function to see if kernel and initrd have matched numbers (warning?)
+ # FUTURE: add another function to see if kernel and initrd have matched numbers (and throw a warning?)
if os.path.isfile(path):
filename = os.path.basename(path)
if self.re_initrd.match(filename):
@@ -138,6 +128,10 @@ class BootUtil:
return self.find_highest_files(path,"initrd.img",self.re_initrd)
return None
+ """
+ Similar to find_kernel and find_initrd, see if a path or filename
+ references a kickstart...
+ """
def find_kickstart(self,path):
# Kickstarts must be explicit.
# FUTURE: Look in configured kickstart path and don't require full paths to kickstart
@@ -149,10 +143,3 @@ class BootUtil:
return joined
return None
-
-
- def sync(self,dryrun=False):
- # FIXME: IMPLEMENT
- return False
-
-