| Hiera is not designed to be able to enumerate all the keys. It can only answer with the value bound to a key (which it arrives at via a large set of rules). You cannot do this by just looking at simple yaml/json files since it is a particular backend that reads those and provides the answer. You can also have backends that are backed by a database, or say LDAP. If you asked for "all keys" you would get a return that potentially consists of very large amounts of data. Further, since lookups are done in a particular context (set of variable values) the result and indeed the set of available keys changes. Thus the answer to the question "give me all keys" is multidimensional - or would need to be constrained with the set of variables that the hiera key resolution depends on - something that is possible for some known variables like facts - but the full set of variables isn't declared anywhere - the backends can do pretty much what they want. It difficult, but not impossible to add "enumeration of keys" to the hiera API, but it would need to have a mechanism for backends to opt in to support it, and also some mechanism for backends to respond with a signal that it would result in too much data. The implementation would be difficult since a backend in hiera 5 is just a simple function with a very clear purpose; too lookup a value. It would probably have to be an additional function that can do the enumeration which each hiera backend function provider would need to implement to support this feature. |