Steven,
It looks like you may be running into
http://projects.puppetlabs.com/issues/12122, which has a potential fix
awaiting review (https://github.com/puppetlabs/hiera/pull/68). The fix
will be going into the current rc series of Hiera.

On Thu, Jun 7, 2012 at 8:23 AM, jcbollinger <[email protected]> wrote:
>
> On Jun 6, 9:30 pm, Steven Truong <[email protected]> wrote:
>> I tried to use both yaml and json backends because some of my users
>> might not know Yaml.
>
>
> They might think they don't, but YAML is a superset of JSON, so any of
> your users who know JSON also know a big chunk of YAML -- in all
> likelihood, enough YAML to encode data for hiera.
>
>
>>  However, when I ran hiera from the CLI, I could
>> only retrieve things from YAML and not in JSON.  The objects in JSON
>> are not overlapped with those in YAML.  I could retrieve all objects
>> when I ran YAML or JSON alone.
>>
>> Is it possible to use both YAML and JSON as Hiera's backends? Or just
>> JSON + puppet or YAML + puppet or MySQL/Redis + puppet? Is Puppet
>> backend required as the second tier?
>
>
> As I understand it, hiera can query multiple backends for the same
> key, but it is possible that it chooses only one backend for each
> hierarchy level.  The Puppet backend is not required at all as far as
> I can tell; if you do not want to look up data in your Puppet
> variables then you should not use it.
>
>
>> cat hiera.yaml
>> ---
>> :backends:
>>            - yaml
>>            - json
>>
>> :hierarchy: - %{operatingsystem}
>>             - common
>> :yaml:
>>         :datadir: /etc/puppet/hierayaml_data
>>
>> :json:
>>         :datadir: /etc/puppet/hierajson_data
>>
>> ls hiera*data
>> hierajson_data:
>> common.json
>>
>> hierayaml_data:
>> common.yaml  Ubuntu.yaml
>
>
> I guess you were hoping that for hierarchy level "common", hiera would
> consult both common.json and common.yaml.  I don't think it works that
> way.  As I understand it, Hiera will choose *one* backend for each
> hierarchy level, based on the order in which the backends are listed
> and on whether the corresponding data source is present.
>
> If you really need separate YAML and JSON data, then this may work
> better:
>
> :backends:
>           - yaml
>           - json
>
> :hierarchy: - %{operatingsystem}
>            - common_yaml
>            - common_json
>
> :yaml:
>        :datadir: /etc/puppet/hierayaml_data
>
> :json:
>        :datadir: /etc/puppet/hierajson_data
>
> -----
>
> Of course, you would also need to rename the YAML and JSON data files
> correspondingly.
>
> Alternatively, just use YAML.  Any JSON-only people will feel almost
> at home right away, and any extra bits they need for this work should
> be easy to pick up.  That will also avoid problems revolving around
> which file should contain each item.
>
>
> John
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/puppet-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to