[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Pulp-list] Client configuration file validation



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),
        )
    ),
)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]