On Thu, Mar 29, 2012 at 6:50 PM, James Cammarata <[email protected]> wrote:
> So the .lower() has been in there forever. The real issue is that I
> changed it to return x, whereas before it was returning the url
> variable, which did not work if the url started with whitespace. The
> lower() just seems to make sure you get http instead of HtTp or
> something random a user may enter, so I'll fix this to be a bit
> smarter. Sorry for the breakage.

Here's my fix:


# git diff
diff --git a/cobbler/utils.py b/cobbler/utils.py
index f30cdff..7a83317 100644
--- a/cobbler/utils.py
+++ b/cobbler/utils.py
@@ -432,8 +432,11 @@ def find_kickstart(url):
     """
     if url is None:
         return None
-    x = url.lower().lstrip()
+    x = url.lstrip()
     for y in ["http://";, "nfs://", "ftp://";, "/"]:
+       # make sure we get a lower-case protocol without
+       # affecting the rest of the string
+       x = re.sub(r"(?i)%s" % y, y, x, count=1)
        if x.startswith(y):
            if x.startswith("/") and not os.path.isfile(x):
                return None


Test results:

$ cobbler profile edit --name=test
--kickstart=/var/lib/cobbler/kickstarts/Test-File.ks
$ cobbler profile report --name=test | grep ^Kickstart
Kickstart                      : /var/lib/cobbler/kickstarts/Test-File.ks
Kickstart Metadata             : {}


This has been merged into the master branch.
_______________________________________________
cobbler mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/cobbler

Reply via email to