@@ -92,11 +92,25 @@ def submit(request):
9292
9393 imgjob .kickstart = "" .join (ks )
9494
95+ vars_re = re .compile (r'^# Var@([\S]+)@([\S]+):(.*)$' )
96+ features_vars = {}
97+
9598 for line in ks :
96- if re .match (r'^#.*?KickstartType:.+$' , line ):
97- ks_type = line .split (":" , 1 )[1 ].strip ()
99+ if not line .startswith ('#' ):
98100 break
99101
102+ vars_match = vars_re .match (line )
103+ if vars_match :
104+ feature = vars_match .group (1 )
105+ var = vars_match .group (2 )
106+ val = vars_match .group (3 ).strip ()
107+ if feature in features_vars :
108+ features_vars [feature ][var ] = val
109+ else :
110+ features_vars [feature ] = {var : val }
111+ elif re .match (r'^#.*?KickstartType:.+$' , line ):
112+ ks_type = line .split (":" , 1 )[1 ].strip ()
113+
100114 if ksname .endswith ('.ks' ):
101115 ksname = ksname [0 :- 3 ]
102116
@@ -117,7 +131,13 @@ def submit(request):
117131 if not ks_type or not repos_type in feat :
118132 repos_type = 'repositories'
119133
120- extra_repos .update (feat .get (repos_type , set ()))
134+ feat_repos = feat .get (repos_type , dict ())
135+ for name , url in feat_repos .items ():
136+ if name in features_vars :
137+ for var , val in features_vars [name ].items ():
138+ url = url .replace ('@%s@' % var , val )
139+ extra_repos .add (url )
140+
121141 overlay .update (feat .get ('pattern' , '' ))
122142 overlay .update (feat .get ('packages' , set ()))
123143
0 commit comments