On 02/27/2014 02:01 PM, Dan Callaghan wrote:
Excerpts from Nick Coghlan's message of 2014-02-27 13:53:23 +1000:
On 02/27/2014 01:48 PM, Nick Coghlan wrote:
The simplest resolution I have been able to come up with is the following:
- Add a "base_distro" context variable in the kickstart rendering. By
default, this is the same as "distro". 2. Update the kickstart snippets to use base_distro rather than distro 3. Add an optional "base_distro" field to our distro records. If that is set, base_distro in the template rendering context is to that rather than yo the same thing as distro.
It occurs to me that this approach would need another tweak: allowing Distro entries to be created directly, since you would still want to be able to say that CentOS7 (for example) was derived from RedHatEnterpriseLinux7, even if you didn't have an RHEL 7 trees loaded into your Beaker instance. I'm open to other ways to tackle the problem that would avoid needing to do that, though.
Everywhere you say "distro" you mean "OS major" (a.k.a. "distro family").
Sort of - the template conditions in some cases currently look like: "distro is osmajor('RedHatEnterpriseLinux7')".
However, you're right that "base_osmajor" might be a more accurate name for the new template variable, and we could set it directly to the text string rather than exposing the rich object directly.
For example, the following conditionals (from default_rhts_compat):
{% if distro.osversion.osmajor.osmajor.startswith('Fedora') %} {% set releasever = distro.osversion.osmajor.osmajor[6:] %} {% if releasever|int >= 15 or releasever == 'rawhide' %} {% set default_rhts_compat = False %} {% endif %} {% else %} {% if distro is osmajor('RedHatEnterpriseLinux7') %} {% set default_rhts_compat = False %} {% endif %} {% endif %}
would become:
{% if base_osmajor.startswith('Fedora') %} {% set releasever = base_osmajor[6:] %} {% if releasever|int >= 15 or releasever == 'rawhide' %} {% set default_rhts_compat = False %} {% endif %} {% else %} {% if base_osmajor == 'RedHatEnterpriseLinux7' %} {% set default_rhts_compat = False %} {% endif %} {% endif %}
But yes, that seems like a viable solution although as you noted it will require some UI work.
I assume we would want to use the "base OS major" when checking excluded families and install options as well -- that will make things easier for system owners. Instead of updating their exclusions and install options for RedHatEnterpriseLinux7 and every single derivative that comes along, they would only need to do it once.
Ah, that's a good point - I'll include that in the RFE.
How about when checking for template snippets? I'm inclined to say not - if instance admins want that behaviour, they can use symlinks to get the same effect.
Cheers, Nick.