diff options
author | Michael DeHaan <mdehaan@redhat.com> | 2006-05-08 10:22:09 -0400 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2006-05-08 10:22:09 -0400 |
commit | 643cf0d5bb69f2933cc88f03ccf288ed0eb52e42 (patch) | |
tree | aea2d041aed77e96ff5c890ad0216c98fc0d42bd /cobbler/utils.py | |
parent | fc086c72640c3f8f51f9a07b76387647fb683025 (diff) | |
download | third_party-cobbler-643cf0d5bb69f2933cc88f03ccf288ed0eb52e42.tar.gz third_party-cobbler-643cf0d5bb69f2933cc88f03ccf288ed0eb52e42.tar.xz third_party-cobbler-643cf0d5bb69f2933cc88f03ccf288ed0eb52e42.zip |
Unit tests pass again.
Diffstat (limited to 'cobbler/utils.py')
-rw-r--r-- | cobbler/utils.py | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/cobbler/utils.py b/cobbler/utils.py index f6ab675..90354c6 100644 --- a/cobbler/utils.py +++ b/cobbler/utils.py @@ -1,6 +1,8 @@ -# Misc heavy lifting functions for cobbler -# -# Michael DeHaan <mdehaan@redhat.com> +""" +Misc heavy lifting functions for cobbler + +Michael DeHaan <mdehaan@redhat.com> +""" import os import re @@ -10,8 +12,10 @@ import subprocess import msg -re_kernel = re.compile(r'vmlinuz-(\d+)\.(\d+)\.(\d+)-(.*)') -re_initrd = re.compile(r'initrd-(\d+)\.(\d+)\.(\d+)-(.*).img') +app_debug = True # essentially an app level global, but the only one + +_re_kernel = re.compile(r'vmlinuz-(\d+)\.(\d+)\.(\d+)-(.*)') +_re_initrd = re.compile(r'initrd-(\d+)\.(\d+)\.(\d+)-(.*).img') _last_error = "" def last_error(): @@ -119,12 +123,12 @@ def find_kernel(path): """ if os.path.isfile(path): filename = os.path.basename(path) - if re_kernel.match(filename): + if _re_kernel.match(filename): return path elif filename == "vmlinuz": return path elif os.path.isdir(path): - return find_highest_files(path,"vmlinuz",re_kernel) + return find_highest_files(path,"vmlinuz",_re_kernel) return None @@ -136,12 +140,12 @@ def find_initrd(path): # FUTURE: try to match kernel/initrd pairs? if os.path.isfile(path): filename = os.path.basename(path) - if re_initrd.match(filename): + if _re_initrd.match(filename): return path if filename == "initrd.img" or filename == "initrd": return path elif os.path.isdir(path): - return find_highest_files(path,"initrd.img",re_initrd) + return find_highest_files(path,"initrd.img",_re_initrd) return None |