Something that just occurred to me when looking at this patch is
that
ksvalidator is going to fail on processing any kickstart file with a
%addon section (or any other section defined outside pykickstart).
Do
we expect to see such kickstart files outside of anaconda? If so,
this
is going to need work.
You are right. My goal was to not touch pykickstart at all. How does the validator handle
%pre and %post sections? Those are also defined in pyanaconda/kickstart.py
module_paths["spokes"].append(("anaconda.addon.%s.spokes.%%s"
> % addon_id, addon_spoke_path))
> +
> + addon_category_path = os.path.join(path, addon_id,
> ui_subdir, "categories")
> + if os.path.isdir(addon_spoke_path):
> +
>
module_paths["categories"].append(("anaconda.addon.%s.categories.%%s"
> % addon_id, addon_category_path))
Do you mean pyanaconda.addon in all these paths?
Yes.. but it should not matter as it is just a key in sys.modules, I will fix it to be
consistent with the rest of course.
> + with progress_report(_("Configuring addons")):
> + ksdata.addon.execute(storage, ksdata, instClass, u)
> +
You may want to conditionalize these two so that they only happen if
there are addons to begin with.
Good idea.
> class AnacondaKSHandler(superclass):
> - def __init__ (self):
> + AddonClassType = AddonData
> +
> + def __init__ (self, addon_paths = []):
> superclass.__init__(self, commandUpdates=commandMap,
> dataUpdates=dataMap)
> self.onPart = {}
>
> + # collect all kickstart addons for anaconda to addons
> dictionary
> + # which maps addon_id to it's own data structure based on
> BaseData
> + # with execute method
> + addons = {}
> +
> + # collect all AddonData subclasses from
> + # for p in addon_paths: <p>/<plugin id>/ks/*.(py|so)
> + # and register them under <plugin id> name
> + for module_name, path in addon_paths:
> + addon_id =
> os.path.basename(os.path.dirname(os.path.abspath(path)))
> + if not os.path.isdir(path):
> + continue
> +
> + classes = collect(module_name, path, lambda cls:
> issubclass(cls, self.AddonClassType))
> + print classes
> + if classes:
> + addons[addon_id] = classes[0](name = addon_id)
> +
> + # Prepare the final structures for 3rd party addons
> + self.addon = AddonRegistry(addons)
> +
> + def __str__(self):
> + return superclass.__str__(self) + "\n" + str(self.addon)
> +
This will all get executed twice, just so you know: Once for
processing
the kickstart file in the special %pre step, and once for the real
pass.
That may not matter. I don't know how much stuff is expected to
happen
in this code and how many addons we realistically expect. It might
also be best in its own method.
Ah, yes you are right. But I am not passing the addon_paths in that step, so it will skip
the loop.
- Chris
_______________________________________________
anaconda-patches mailing list
anaconda-patches(a)lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches