[Puppet-dev] Re: yaml Kwalify schema for hiera files

2015-04-21 Thread Corey Osman
So I have used the built in JSON backend which makes it easy to validate a 
json file using any number of tools.  
However, some of my clients prefer the default hiera yaml backend which 
there is no tool to validate basic parameter values being dumped into a 
hiera file, and YAML.load_file is essentially useless as a validator.

For reference:
https://github.com/gds-operations/puppet-syntax/issues/39

Things I want to check are that the user supplied the necessary syntax to 
create a list, hash or other data types in yaml much like the JSON 
equivalent.  The difference being that JSON is a subset of YAML and by 
default comes with its own validator (afaik).   Since the YAML parser is so 
generic I figured that puppetlabs might have already created a Kwalify 
schema to validate hiera files that use the yaml backend.

I have come across a few situations where if the user fat fingers 
characters into the hiera files, all hell breaks loose because the YAML 
parser really doesn't care whats in the file and keys are never found.

Example:

---
{}
fsdafsdone::two::three: some_value


hiera('one::two::three') will never return some_value. 


Corey
On Wednesday, March 25, 2015 at 2:49:55 PM UTC-7, henrik lindberg wrote:

 On 2015-25-03 20:06, Corey Osman wrote: 
  Hi, 
  
  Has anybody created a yaml Kwalify schema for hiera files.  I would like 
 to validate my yaml files against an official hiera schema using Kwalify. 
  Since the YAML spec varies greatly a schema is required to validate hiera 
 specific keys. 
  

 Exactly which hiera files do you mean? 

 The format is very much up to the implementation of a particular backend. 

 I also wonder if what you are trying to achieve is possible to check 
 with Kwalify - I expect it to load the yaml using a yaml implementation, 
 and thus any lexical problems in your yaml files have already occured 
 due to differences in yaml implementations. 

 The result could still be valid - only not what you intended. 

 This lexical problem is different than validating that the structural 
 content follows a particular yaml schema. 

 - henrik 

  
  Corey 
  


 -- 

 Visit my Blog Puppet on the Edge 
 http://puppet-on-the-edge.blogspot.se/ 



-- 
You received this message because you are subscribed to the Google Groups 
Puppet Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-dev/c4fb0d40-53a4-402a-9d25-a9eb4c9e6d41%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet-dev] Re: yaml Kwalify schema for hiera files

2015-03-25 Thread Henrik Lindberg

On 2015-25-03 20:06, Corey Osman wrote:

Hi,

Has anybody created a yaml Kwalify schema for hiera files.  I would like to 
validate my yaml files against an official hiera schema using Kwalify.  Since 
the YAML spec varies greatly a schema is required to validate hiera specific 
keys.



Exactly which hiera files do you mean?

The format is very much up to the implementation of a particular backend.

I also wonder if what you are trying to achieve is possible to check 
with Kwalify - I expect it to load the yaml using a yaml implementation, 
and thus any lexical problems in your yaml files have already occured 
due to differences in yaml implementations.


The result could still be valid - only not what you intended.

This lexical problem is different than validating that the structural 
content follows a particular yaml schema.


- henrik



Corey




--

Visit my Blog Puppet on the Edge
http://puppet-on-the-edge.blogspot.se/

--
You received this message because you are subscribed to the Google Groups Puppet 
Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-dev/mevahl%24do3%241%40ger.gmane.org.
For more options, visit https://groups.google.com/d/optout.