On Thu, 2008-10-16 at 17:11 -0400, Bryan Kearney wrote:
@@ -22,6 +22,7 @@ import shutil
import subprocess
import time
import logging
+import urllib
I'd rather see urlgrabber used than raw urllib. The API is nicer and it
will get us more functionality in the long run
@@ -34,6 +35,19 @@ import pykickstart.version as ksversion
import imgcreate.errors as errors
import imgcreate.fs as fs
+def path_is_url(path):
+ pupper = path.upper()
+ return (pupper.startswith("HTTP://")) or
(pupper.startswith("FTP://"))
+
+def verify_kickstart(path):
+ verified = False
+ if not path is None:
+ if path_is_url(path):
+ verified = True
+ else:
+ verified = os.path.isfile(path)
+ return verified
+
Given that this doesn't cover all of the URL types that are supported
(https:// and file:// for example), it's probably better to just assume
that it's "valid" and ensure that we have good error handling for when
its not. Especially since we'll have to have that error handling anyway
for the case of an improper URL being given.
Jeremy