[j-nsp] configuration archival, commit comments
Mike Williams
mike.williams at comodo.com
Mon Mar 31 10:02:49 EDT 2014
I managed to find an hour or so today to look at this further.
A commit script is the result. My very first!
match configuration {
var $comment = $junos-context/commit-context/commit-comment;
if( jcs:empty ($comment)) {
<xnm:error> {
<message> "No comment specified";
}
}
var $version = version;
<change> {
<junos:comment> "Automatic commit annotation; " _ $comment;
<version> $version;
}
}
Junos would just complain "warning: statement has no contents; ignored" when I
tried adding just a comment/annotation, hence the 'change' to version.
version is the very first line of the config, so the annotation ends up right
at the top.
Separately we commit every archived config to a git repo so we end up with
stuff like this;
$ git diff r1..r2
...
@@ -1,5 +1,5 @@
-## Last changed: 2014-03-31 13:46:45 UTC
-/* Automatic commit annotation; remove old annotation */
+## Last changed: 2014-03-31 13:50:03 UTC
+/* Automatic commit annotation; test annotation */
...
...
Mike WilliamsOn Thursday 20 March 2014 13:50:21 wrote:
> Hi all,
>
> Random thought for the day.
>
> You can archive the entire config after each commit (archival configuration
> transfer-on-commit).
> You can apply a comment to each commit (# commit comment "blah")
>
> How do you archive that comment?
>
> It's not included in the config.
>
>
> Thanks
--
Mike Williams
More information about the juniper-nsp
mailing list