To allow deep merging of hashes/arrays in smart class parameters I need to
change the value of the parameter matched in host/hostgroup and also the
element it came from.
The element can be seen in "Additional info" in the "Parameters" tab of
host/hostgroup to show which override caused the value to be picked for the
parameter.
For the example showed in Feature #3309: Support deep merging of hash structures in smart class parameters - Foreman I can
create an array of elements:
override of: hostgroup = 'Example' value: {"example":{"foo": "bar"}}
override of: fqdn = 'foo.example.com' value: {"example":{"bar": "baz"}}
would result in:
example:
foo: bar
bar: baz
element: ["hostgroup", "fqdn"]
my problem is in this case:
a smart class parameter of type hash with two overrides:
override of: domain = 'example.com' value: {"a": "b"}
override of: os = 'Example' value: {"a": "c"}
when using deep merge the result is:
but what do I put as the element?
only 'os' (like it is today)? ["os", "domain"] because it did merge them
even though it looks the same as today?
should I change it to {"a": ["b", "c"]}? does this case even make sense?
···
a: c (or a: b depending on the order)
> To allow deep merging of hashes/arrays in smart class parameters I need to
> change the value of the parameter matched in host/hostgroup and also the
> element it came from.
> The element can be seen in "Additional info" in the "Parameters" tab of
> host/hostgroup to show which override caused the value to be picked for the
> parameter.
>
> For the example showed in Feature #3309: Support deep merging of hash structures in smart class parameters - Foreman I
> can create an array of elements:
> override of: hostgroup = 'Example' value: {"example":{"foo": "bar"}}
> override of: fqdn = 'foo.example.com' value: {"example":{"bar": "baz"}}
> would result in:
> example:
> foo: bar
> bar: baz
> element: ["hostgroup", "fqdn"]
>
> my problem is in this case:
> a smart class parameter of type hash with two overrides:
> override of: domain = 'example.com' value: {"a": "b"}
> override of: os = 'Example' value: {"a": "c"}
>
> when using deep merge the result is:
> a: c (or a: b depending on the order)
> but what do I put as the element?
> only 'os' (like it is today)? ["os", "domain"] because it did merge them
> even though it looks the same as today?
>
element == where the data came from, if it didnt come from domain, then we
dont show it imho.
> should I change it to {"a": ["b", "c"]}? does this case even make sense?
>
I would not advise that, as that could change the parameter type (from
string to array of strings).
Ohad
···
On Mon, Sep 1, 2014 at 5:41 PM, Ori Rabin wrote:
–
You received this message because you are subscribed to the Google Groups
"foreman-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.