[Pulp-list] Client configuration file validation

Jay Dobies jason.dobies at redhat.com
Wed Dec 7 13:25:26 UTC 2011


This is really cool. As much as I don't care for XML I do like the 
concept of XSD. This is a nice lightweight approach to saving the user a 
ton of time because they fat fingered something in the conf file.

On 12/02/2011 06:58 PM, Jeff Ortel wrote:
> All,
>
> In response to some issues I saw on pulp-list this week as described in
> bug:759153, I decided to implement and INI file schema documentation and
> validation mechanism which I have applied to the client .conf files.
> This mechanism uses a schema (examples below) to validate INI files.
> Validation errors (exceptions) contain clear, understandable messages so
> user (and developers) can identity and correct errors in INI files. On
> the client, configuration files are validated when they are loaded.
>
> The validation functionality is implemented in pulp/common so that it
> can be leveraged by both the client and server. I know that the server
> has taken a different approach to configuration files than the client
> which includes the API used (ConfigParser vs. INIParser) to read the
> files, as well as, defaulting and (maybe) validation approaches. At some
> point, we need to reconcile.
>
> In any case, if you modify the contents of either admin.conf or
> consumer.conf, please update the schema(s). Also, I took a first pass at
> the schema for these files. If you get a chance, please review and
> correct as needed. The schema is pretty simple and self explanatory but
> I'll document it on the wiki next week.
>
> Regards,
>
> Jeff
>
>
>
>
> =====================================================
>
>
> admin.conf (defined in pulp/client/admin/config.py)
>
> SCHEMA = (
> ('server', REQUIRED,
> (
> ('host', REQUIRED, ANY),
> ('port', REQUIRED, NUMBER),
> ('scheme', REQUIRED, '(http$|https$)'),
> ('path', REQUIRED, ANY),
> ('interval', REQUIRED, NUMBER),
> )
> ),
> ('plugins', REQUIRED,
> (
> ('plugin_dirs', REQUIRED, ANY),
> )
> ),
> )
>
> consumer.conf (defined in pulp/client/consumer/config.py)
>
> SCHEMA = (
> ('server', REQUIRED,
> (
> ('host', REQUIRED, ANY),
> ('port', REQUIRED, NUMBER),
> ('scheme', REQUIRED, '(http$|https$)'),
> ('path', REQUIRED, ANY),
> ('interval', REQUIRED, NUMBER),
> )
> ),
> ('client', REQUIRED,
> (
> ('repo_file', REQUIRED, ANY),
> ('mirror_list_dir', REQUIRED, ANY),
> ('gpg_keys_dir', REQUIRED, ANY),
> ('cert_dir', REQUIRED, ANY),
> ('consumer_cert', REQUIRED, ANY),
> )
> ),
> ('reboot', REQUIRED,
> (
> ('permit', REQUIRED, BOOL),
> ('delay', REQUIRED, NUMBER),
> )
> ),
> ('gpg', REQUIRED,
> (
> ('permit_import', REQUIRED, BOOL),
> )
> ),
> ('heartbeat', REQUIRED,
> (
> ('seconds', REQUIRED, NUMBER),
> )
> ),
> ('messaging', REQUIRED,
> (
> ('scheme', REQUIRED, '(tcp$|ssl$)'),
> ('port', REQUIRED, NUMBER),
> ('cacert', OPTIONAL, ANY),
> ('clientcert', OPTIONAL, ANY),
> )
> ),
> ('cds', REQUIRED,
> (
> ('baseurl', REQUIRED, ANY),
> ('keyurl', REQUIRED, ANY),
> ('ksurl', REQUIRED, ANY),
> )
> ),
> ('plugins', REQUIRED,
> (
> ('plugin_dirs', REQUIRED, ANY),
> )
> ),
> )
>
>
> _______________________________________________
> Pulp-list mailing list
> Pulp-list at redhat.com
> https://www.redhat.com/mailman/listinfo/pulp-list


-- 
Jay Dobies
Freenode: jdob @ #pulp
http://pulpproject.org | http://blog.pulpproject.org




More information about the Pulp-list mailing list