[j-nsp] jcs:split() function with errors

ben b benboyd.lists at gmail.com
Fri Jul 22 14:58:01 EDT 2011


On Fri, Jul 22, 2011 at 1:37 PM, ben b <benboyd.lists at gmail.com> wrote:

> Slax dudes,
>
> i'm running into a weird issue that i can't seem to figure out...
>
> i'm try to find out the number of pipes "|" in all of my interface
> descriptions, but for some reason the jcs:split() function errors out in my
> commit script.  Does anyone have any suggestions?
>
> junos version 10.0R3.10
>
> code:
> /* Loop through all logical interfaces checking for descriptions and
> format*/
> for-each( interfaces/interface/unit ) {
>  /* Missing description */
> if( jcs:empty( description ) ) {
> <xnm:error> {
>  call jcs:edit-path();
> <message> "!!!CONFIGURATION ERROR!!! Interface description is MISSING.
> Format = 'INTERFACE TYPE | CIRCUIT ID | CONNECTING ROUTER | CONNECTING PORT
> | FUNCTION'";
>  }
> }
> else {
>  var $description_parts = jcs:split("|", description);
> /*
>  if ( not($description_parts[5]) ) {
> <xnm:error> {
> call jcs:edit-path();
>  <message> "!!!CONFIGURATION ERROR!!! Interface description is INCORRECT.
> Format = 'INTERFACE TYPE | CIRCUIT ID | CONNECTING ROUTER | CONNECTING PORT
> | FUNCTION'";
>  }
> }
> */
>  }
>
> }
> when i comment out
> var $description_parts = jcs:split("|", description);
> i don't run into errors
>
> I have 4 interface descriptions, and when i commit, this is all i see:
>
> error: 4 errors reported by commit scripts
> error: commit script failure
>

Here is my cscript.log (yes i know my date is wrong... )

Sep  5 08:45:23 cscript script processing begins
Sep  5 08:45:23 reading commit script configuration
Sep  5 08:45:23 testing commit script configuration
Sep  5 08:45:23 opening commit script
'/var/db/scripts/commit/validation.slax'
Sep  5 08:45:23 script file '/var/db/scripts/commit/validation.slax': size =
67310 ; md5 = bd939292d9077b1defe91f2fbee91e94 sha1 =
cdccbfddf0ae75101931380d42ca0b5ceb18cf9d sha-256 =
1925ca096715357aa42c2a791cf48d6ddd91c345086eb28c944978c07df3f1a2
Sep  5 08:45:23 reading commit script 'validation.slax'
Sep  5 08:45:23 running commit script 'validation.slax'
Sep  5 08:45:23 regex error: empty (sub)expression
Sep  5 08:45:23 regex error: empty (sub)expression
Sep  5 08:45:23 regex error: empty (sub)expression
Sep  5 08:45:23 regex error: empty (sub)expression
Sep  5 08:45:23 processing commit script 'validation.slax'
Sep  5 08:45:24 no errors from validation.slax
Sep  5 08:45:24 saving commit script changes for script validation.slax
Sep  5 08:45:24 summary of script validation.slax: changes 18, transients 0,
syslog 0
Sep  5 08:45:24 cscript script processing ends


More information about the juniper-nsp mailing list