Skip to content

Commit

Permalink
ncm-sysconfig: Update and clarify schema
Browse files Browse the repository at this point in the history
* Break apart schema into sub-types for clarification
* Disallow empty values
* Make use of schema in tests
* Add annotations based on paraphrased description from pod.
  • Loading branch information
jrha committed Jun 15, 2018
1 parent 77e22ce commit aa52055
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
26 changes: 22 additions & 4 deletions ncm-sysconfig/src/main/pan/components/sysconfig/schema.pan
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,34 @@
# ${developer-info}
# ${author-info}


declaration template components/sysconfig/schema;

include 'quattor/schema';

@documentation{
Contents of a sysconfig file modelled as a dict of key-value pairs.
Two reserved keys `prologue` and `epilogue` are treated specially,
their values will be copied verbatim into the file before or after the key-pair definitions.
Example:
'/software/components/sysconfig/files/scfg' = dict(
'epilogue', 'export LANG=C',
'KEY', 'VALUE',
);
This will create the file `/etc/sysconfig/scfg` which contains:
KEY=VALUE
export LANG=C
}
type component_sysconfig_file = string(1..){};

type component_sysconfig = {
include structure_component
'files' ? string{}{}
@{ dict of dicts with a file name as the first key and the contents of each file as the child dict. }
'files' ? component_sysconfig_file{}
};

bind '/software/components/sysconfig' = component_sysconfig;


2 changes: 2 additions & 0 deletions ncm-sysconfig/src/test/resources/configure.pan
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
object template configure;

include 'components/sysconfig/schema';

prefix '/software/components/sysconfig';

'files/examplefile/key1' = 'testvalue';
Expand Down

0 comments on commit aa52055

Please sign in to comment.