Skip to content

project-xavier/xavier-payload-sanitizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status codecov

Sanitizes input payload json files to xavier-analytics.

Checks input files for error conditions specified by the lines in an input issues conditions file, an example of which is included in the resources folder and can be used as a default.

Sets failing VM elements to be 'retired' in the output file so the report generation process ignores the failing element.

Issues Conditions File Format

  1. This file is divided into sections containing conditions for different sections of the payload file.
  2. The sections are divided by header lines.
  3. At the moment there are 2 functional header lines , ###vms and ###hosts
  4. Following each header line, jsonpath query strings can be placed that identify an instance of that section of the payload file which meets a particular error condition. Each error condition should occupy a new line in the file.
  5. An error condition line in the ###vms section should identify its id, eg $.ManageIQ::Providers::Vmware::InfraManager[*].vms[?(@.host == null )].id
  6. An error condition line in the ###hosts section should identify its ems_ref, eg $.ManageIQ::Providers::Vmware::InfraManager[*].hosts[?(@.ems_cluster == null )].ems_ref

Build

  1. From the project root run (to include project dependencies in jar)
  2. mvn clean assembly:assembly -DdescriptorId=jar-with-dependencies

Usage

There are 3 possible input arguments which can be included in any order:

  1. --input followed by a path to a failing input payload file which needs to be sanitized. Mandatory.

  2. --output followed by the desired path to the sanitized output file. If this argument is omitted or has a value of null or empty, the output file will be produced in the same folder as the input file with a file name based on the input file name with _sanitized.json at the end.

    eg an input file name of input.json will result in an output file named input_sanitized.json

  3. --issues followed by the path to the issues conditions file to use. If this argument is not supplied the issues conditions file shipped inside the jar will be used as a default.

The tool is intended to be used from the command line, eg running from the same folder as the jar:

java -jar xavier-payload-sanitizer-0.0.1-SNAPSHOT-jar-with-dependencies.jar --input /{path to input file}/cfme_inventory_0.json --issues /{path to issues conditions file}/issues_conditions.txt --output /{path to output file}/sanitizedJson.json

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages