output: add more items to mustach tags

Base level printing; localstime, number of ranges and shared networks,
project version, and file paths and time stamps.

Also print error and stop template processing when unknown tag is
encountered.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2017-11-14 10:46:48 +00:00
parent d24313d25a
commit ff3d9523e6
No known key found for this signature in database
GPG key ID: A9553245FDE9B739
4 changed files with 154 additions and 34 deletions

View file

@ -114,6 +114,12 @@ Summary:
backup_percent: 2
status: 0
number_of_ranges: 5
number_of_shared_networks: 2
--- skip ok ---
Subnets:
location: example1
@ -189,3 +195,9 @@ Summary:
backup_percent: 2
status: 0
number_of_ranges: 5
number_of_shared_networks: 2

View file

@ -8,14 +8,16 @@ if [ ! -d tests/outputs ]; then
mkdir tests/outputs
fi
remove='/gettimeofday:/d; /^localtime:/d; /^conf_file_/d; /lease_file_/d; /^template_file_/d; /^version:/d'
dhcpd-pools -c $top_srcdir/samples/dhcpd.conf -l $top_srcdir/samples/dhcpd.leases \
--mustach $top_srcdir/samples/mustach.template |
sed '/gettimeofday:/d; /lease_file_mtime:/d' >| tests/outputs/$IAM
sed "$remove" >| tests/outputs/$IAM
echo "--- skip ok ---" >> tests/outputs/$IAM
dhcpd-pools -c $top_srcdir/samples/dhcpd.conf -l $top_srcdir/samples/dhcpd.leases \
--mustach $top_srcdir/samples/mustach.template --skip=ok --warning 44 |
sed '/gettimeofday:/d; /lease_file_mtime:/d' >> tests/outputs/$IAM
sed "$remove" >> tests/outputs/$IAM
diff -u $top_srcdir/tests/expected/$IAM tests/outputs/$IAM
exit $?