Discovery fails using pattern Windows OS - Servers Error: JAVASCRIPT_CODE_FAILURE: "Caused by error in Ad hoc script 'EvalClosure-Parse the IP DNS names in EVAL' at line 8


Description

Discovery fails using pattern  Windows OS - Servers  Error: JAVASCRIPT_CODE_FAILURE: "Caused by error in Ad hoc script 'EvalClosure-Parse the IP DNS names in EVAL' at line 8

Steps to Reproduce

1. Run discovery on the Windows Server
2. Discovery fails while executing, Windows OS - Servers pattern with below error
""
JAVASCRIPT_CODE_FAILURE: "Caused by error in Ad hoc script 'EvalClosure-Parse the IP DNS names in EVAL' at line 8
""

Workaround

  1. Goto sa_pattern.LIST
  2. Open the pattern DNS (Shared Library), Note: NOT the "DNS Shared Library" pattern
  3. Goto step "Parse the IP DNS Names in EVAL"
  4. Replace the old code with new code as showing in demo.png in the attachments of this KB
  5. Under "Related Links", click on "Synchronize with MID Servers"

    OLD CODE
    :
    if (nslookup_response.indexOf(\"Name: \") >= 0 ) {
        var regex = /Name: (\\s+.*)Address:/;
        rtrn = regex.exec(nslookup_response)[1]
        //getting the exact Group match of the regex with the index of 1
     } else if (nslookup_response.indexOf(\"Name= \") >= 0 ) {
        var regex = /Name= (\\s+.*)Address:/;
        rtrn = regex.exec(nslookup_response)[1]
        //getting the exact Group match of the regex with the index of 1
     }

    NEW CODE:
    var regex = /Name(?:=|:)\\s*(.*?)\\s*Address:/;
    var temp = regex.exec(nslookup_response);
    rtrn = temp && temp[1];
     







Related Problem: PRB1437163