Hi all,
At the Roadmap last week, I promised to put together a proposal to
satisfy Ohad's concerns around parameter conflicts when using multiple
hostgroups. So here it is.
This is the simplest implementation I can come with, which retains
some flexibility. There are, no doubt, implementations which will look
nicer in the UI, but would require more work. I'm aiming for
least-work-to-implement. Pretty can come later
There's only one mock-up screenshot I've made in GIMP - I believe it
illustrates the key points about the changes to the Hostgroup type,
and is attached.
The concept is to extend the Hostgroup table, adding a numerical
column "Priority". This is a piece of integer data which describes
which Hostgroup should win when two Hostgroups are specifying the same
Parameter. In my example the lower value wins, but this could be
easily reversed if the community feels that's clearer. We can also
have some kind of validation - if you try to assign a second Hostgroup
of the same Priority to a given Host, the Save validation can throw an
error.
Let's see a use case:
In my screenshot, I could safely assign Base/Core/EMEA (which still
inherits Base and Core as before), and Base/Core/Build17 (which is
fine for now, as classes are singletons) which has a different
Priority, and also QA, which is different again. If I chose to assign
Base/Core/ENENA, this would not validate - this allows us to specify
mutually exclusive Hostgroups.
If QA and Base/Core/EMEA both specify parameter "foo", then QA will
win, and it's version will appear in the YAML output.
In terms of UI changes, I think we can re-use a lot of the code from
the Puppetclasses tab in the Host Edit page. We already parse a list
of classes and provide a tree structure - this would be fine for the
Hostgroups too, at least for now. For the Hostgroup Edit page, it's
just an extra editbox. Along with the DB change, it should just be
backend changes from there, mainly to the Save validation and the ENC
output code.
I'm happy to take a shot at coding this if there's agreement from the
community that this is a reasonable implementation. I know Ohad's got
a lot on his plate right now
As always, feedback is not just welcome, it's actively encouraged
Cheers,
Greg