182 views

Description

Run Audit does not work for Desired State plugin on Oracle database. (Run Audit does work properly for Desired State plugin on MySQL database.)

Show XML displays a very long commented script. MySQL manages this long comment string and then executes the script code (which is after the comment). However, on an Oracle database, the comment string itself is truncated so the script code is stripped and cannot be executed. No error message is displayed.

Steps to Reproduce

  1. Deploy Helsinki Patch 2 for Oracle database.
  2. Activate the Desired State Certification plugin with demo data.
  3. Run a base system demo data audit to ensure that it works correctly.
    1. Navigate to Compliance > Audits > Database Audit.
    2. Note the number of records in the Audit Results tab.
    3. Change Run field to On Demand and click Save.
    4. Click the Run Audit button.
      The Audits list view should be displayed.
    5. Click Database Audit again.
    6. Note the number of records in the Audit Results tab.
      The number should be higher than the value noted step 3b.
    7. Right-click on Show XML and save the contents of the XML.
    8. Review the generated script:
      <script>new SNC.CertificationProcessing().runAudit(current.sys_id, current.template.filter.sys_id, current.template.sys_id);</script>.
  4. Create a new custom audit based on the same "Database Template - 1" template as used above. We are still using Oracle database at this stage.
    1. Navigate to Compliance > Audits.
    2. Create a new record,with the following values:
      • Name: 1 Custom Audit
      • Template: Database Template - 1
      • Run: On Demand
    3. Save the new record.
    4. Note the number of records in the Audit Results tab below. 
      It should be zero records.
    5. Click the Run Audit button.
      The Audits list view should be displayed.
    6. Click 1 Custom Audit.
    7. Note the number of records in the Audit Results tab.
      This time you should see that it is still zero records. No results were generated.
    8. Right-click on Show XML.
      The following script is displayed:

      <script>new SNC.CertificationProcessing().runAudit(current.sys_id, current.template.filter.sys_id, current.template.sys_id);
      /*
      /////////////////////////////////////////////////////
      /// This script works with Data Center Zones filter //
      /////////////////////////////////////////////////////

      var desiredFloorSpaceUsage = 30;        // Value to audit against
      var assignToUser = '46d44a23a9fe19810012d100cca80666';     // Beth Anglin
      var assignToGroup = '8a5055c9c61122780043563ef53438e3';    // Hardware group
      var taskMsg = '

      Note that the script is not enclosed by an end comment tag and also the code new SNC.CertificationProcessing().runAudit is missing (see XML from step 3h).

  5. If you do the above test steps on MySQL, you will find that steps 4a-h work correctly. The issue only occurs with custom audits on Oracle.

Workaround

The truncation is happening on the "Schedule Script Execution" (sysauto_script) base system table, specifically on a field named script with a type = Script (Plain). The limits are being hit on sys_dictionary_override:default_value, which is currently set to string(512). Oracle is honoring the limits, unlike MySQL.

Possible workaround on Oracle instance:

  1. Go to the script field.
  2. Manually delete partial commented text below. The onlyr elevant code needed in script for Run Audit is:  (new SNC.CertificationProcessing().runAudit(current.sys_id, current.template.filter.sys_id, current.template.sys_id); ):

/*
/////////////////////////////////////////////////////
/// This script works with Data Center Zones filter //
/////////////////////////////////////////////////////

var desiredFloorSpaceUsage = 30; // Value to audit against
var assignToUser = '46d44a23a9fe19810012d100cca80666'; // Beth Anglin
var assignToGroup = '8a5055c9c61122780043563ef53438e3'; // Hardware group
var taskMsg = '


Related Problem: PRB697358

Seen In

Geneva Patch 6
Geneva Patch 7

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2017-04-07 13:25:54
Published:2016-07-29