diff options
author | Anas Nashif <anas.nashif@intel.com> | 2012-06-02 23:28:41 +0100 |
---|---|---|
committer | Anas Nashif <anas.nashif@intel.com> | 2012-06-02 23:28:41 +0100 |
commit | f3bd4c72e28d09b181f4ac8ae758d4a842567ca2 (patch) | |
tree | 27dfd4c9f42e397ffc793f1fa7be7e48226428ac | |
parent | c95fb72006ab0f0a1ee526903be1aacdd540772d (diff) | |
download | kickstarter-f3bd4c72e28d09b181f4ac8ae758d4a842567ca2.tar.gz kickstarter-f3bd4c72e28d09b181f4ac8ae758d4a842567ca2.tar.bz2 kickstarter-f3bd4c72e28d09b181f4ac8ae758d4a842567ca2.zip |
support user/password in repo
-rw-r--r-- | kswriter/KSWriter.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/kswriter/KSWriter.py b/kswriter/KSWriter.py index c20f1f6..d8da26f 100644 --- a/kswriter/KSWriter.py +++ b/kswriter/KSWriter.py @@ -5,6 +5,7 @@ import yaml import os, re import sys import errno +from urlparse import urlparse from kickstart import kickstart @@ -89,7 +90,7 @@ class KSWriter(): def process_files(self, meta, repos): new_repos = [] - if meta.has_key("Architecture") and meta['Architecture']: + if ( meta.has_key("Architecture") and meta['Architecture'] ) or ( meta.has_key("Distribution") and meta['Distribution']): for repo in repos: r = {} r['Name'] = repo['Name'] @@ -100,9 +101,16 @@ class KSWriter(): repourl = repourl.replace("@ARCH@", self.arch or meta['Architecture']) if meta.has_key("Distribution") or self.dist: repourl = repourl.replace("@DIST@", self.dist or meta['Distribution']) - r['Url'] = repourl.replace("@RELEASE@", meta['Baseline']) - new_repos.append(r) + url = repourl.replace("@RELEASE@", meta['Baseline']) + o = urlparse(url) + new_url = "%s://" % o[0] + if repo.has_key('Username') and repo['Username']: + new_url = "%s%s" % (new_url, repo['Username'] ) + if repo.has_key('Password') and repo['Password']: + new_url = "%s:%s@" % (new_url, repo['Password'] ) + r['Url'] = "%s%s%s" % (new_url, o[1], o[2] ) + new_repos.append(r) else: new_repos = repos |