Often when testing I will specify the inst.stage2= kernel option to tell Fedora/anaconda where to download the stage2 image. This then would differ and needs to override both the tree= ks_meta option and the kickstart url option.
I'm wondering what the best way would be to support this (if at all). Currently koan does this:
# If breed is ubuntu/debian we need to source the install tree differently # as preseeds are used instead of kickstarts. if profile_data["breed"] in ["ubuntu", "debian", "suse"]: self.get_install_tree_from_profile_data(profile_data) else: # find_kickstart source tree in the kickstart file self.get_install_tree_from_kickstart(profile_data)
I guess the kickstart data is in general better than the profile data as the kickstart template could conceivably not use the $tree variable at all.
Perhaps add a new function, so something like:
if profile_data["breed"] in ["ubuntu", "debian", "suse"]: self.get_install_tree_from_profile_data(profile_data) else: # find install source tree from kernel options if not self.get_install_tree_from_kernel_options(profile_data) # Otherwise find kickstart source tree in the kickstart file self.get_install_tree_from_kickstart(profile_data)
def get_install_tree_from_kernel_options(self, profile_data): """ Split kernel options to obtain the inst.stage2 path. Generate the install_tree using the http_server and the tree obtained from the inst.stage2 path
"""
try: tree = profile_data["kernel_options"].split() # Ensure we only take the tree in case ks_meta args are passed # First check for tree= in ks_meta arguments meta_re = re.compile('inst.stage2=') tree_found = '' for entry in tree: if meta_re.match(entry): tree_found = entry.split("=")[-1] break
if tree_found == '': return False else: tree = tree_found tree_re = re.compile('(http|ftp|nfs):') # Next check for installation tree on remote server if tree_re.match(tree): tree = tree.replace( "@@http_server@@", profile_data["http_server"]) profile_data["install_tree"] = tree else: # Now take the first parameter as the local path profile_data["install_tree"] = "http://" + \ profile_data["http_server"] + tree
if self.safe_load(profile_data, "install_tree"): print("install_tree:", profile_data["install_tree"]) else: print("warning: kickstart found but no install_tree found") except: pass
There's a fair amount of duplication with get_install_tree_from_profile_data(), so perhaps a helper function is in order.
Thoughts?
cobbler@lists.fedorahosted.org