On Wednesday, April 29, 2015 at 4:39:39 AM UTC-5, Dan Gibbons wrote:
>
> Hi,
>
> I'm just starting to use create_resources and hash merging which I have 
> working but I'm not sure how I can avoid duplicating some of the hash 
> values further up in the hierarchy.
>
> For example:
>
> - I have set :merge_behavior: deeper and installed the deep_merge gem
> - I'm using the eyaml backend
>
> # hiera.yaml (partial)
> :hierarchy:
>   - "node/%{::fqdn}"
>   - "%{::environment}"
>   - "%{::location}"
>   - "%{::flavour}"
>   - common
>
>
> # common.eyaml
>  ---
> windows_webconfig:
>   website1:
>     name: MyWebSiteExample
>     32_bit: false
>     pipeline_mode: Integrated
>     runtime_version: v4.0
>     root_web_folder: 'd:\webroot'
>     bindings:
>       -
>         port: 80
>         host_header: dan.local.com
>         ip_address: *
>         protocol: http 
>   website2:
>     name: MyWebSiteExample2
>     32_bit: false
>     pipeline_mode: Integrated
>     runtime_version: v4.0
>     root_web_folder: 'd:\webroot'
>     bindings:
>       -
>         port: 80
>         host_header: dan.somewhere.com
>         ip_address: *
>         protocol: http 
>
>
> Now what I'd like to do is only update the bindings for particular 
> environments and not have to duplicate the whole hash, something like this:
>
> # uat.eyaml
> ---
> windows_webconfig:
>   website1:
>      bindings:
>       -
>         port: 80
>         host_header: dan.uat.com
>         ip_address: *
>         protocol: http 
>   website2:
>      bindings:
>       -
>         port: 80
>         host_header: dan.uat.com
>         ip_address: *
>         protocol: http 
>  
>
>
> The above (uat.eyaml) doesn't work unless I replicate the whole hash so I 
> was wondering if this is by design of the merging and if there is another 
> way I can achieve my aim of not duplicating the site definitions.  I 
> experimented with separating the "bindings" out into a separate hash and 
> passing this into create_resources but it's kind of messy and doesn't work 
> very well.
>
>

Like LinuxDan, I don't immediately see an issue with your YAML, and I think 
it should support hash merging in the way you want.  The issue might very 
well be with the (3rd-party) eyaml back end.  Hiera's architecture makes 
each back end responsible for all aspects of translating the keys presented 
to it into values.  For some, hash merging doesn't even make sense.

However, if you have updated any Ruby components used by the master, then 
do also be sure to restart it afterward.  The master has means to switch 
out Ruby classes once it has loaded them.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/7327fa3d-8593-426b-8e2d-a558d892c2b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to