JSON Configuration Files
From opCharts 4.1.0, opEvents 3.1.0, opHA 3.1.0, opReports 4.1.0 and opConfig 4.1.0 version, the .nmis configuration files will be replaced by .json files.
The installer will perform all the conversion, and it will be merging as always the old configuration items with new configuration items.
IMPORTANT When migrate to one of these products versions, upgrading all products will be required.
New opcommon-cli tool
A new action is available with /usr/local/omk/bin/opcommon-cli.pl to convert .nmis files to .json files if needed.
It has the following actions:
- convert_json_file: Will convert .nmis file into a json file. It has 3 options:
- file: The file to convert.
- backup: t/f: True by default. Will move the .nmis file to the archive_converted_files directory.
replace_qr: t/f: True by default. Will replace the qr// by "" reading the file content as a string. Please note, if the file has non quoted qr, the conversion to json will fail, with a message:
Error converting json
file
: encountered object
'(?^:Category:\((\d+)\); User:([\w\\ ]{0,256}); (.+)$)'
, but neither allow_blessed ...
- replace_nmis: t/f: True by default. Will replace the ".nmis" by ".json" reading the file content as a string.
- force: t/f: False by default. Will override the .json file if is exist previously when true.
- replace_copy: t/f: False by default. Will replace qr// for "//" instead of "" in copy* elements. This is a convention to know when an element is a regular expression or not, in new opEvents version using json files for EventRules.json file.
- convert_dir_file: Will scan a directory and convert nmis files to json files, using backup, replace_qr and replace_nmis to true but for EventActions will do an exception. This file has quoted qr so it won't need to be converted.
File Migration
The installer will run the common-cli tool to convert all the .nmis files in the /conf directory into .json.
The files will be moved to the archive directory, by default conf/archive, but it can be modified in the configuration item archive_converted_files.
JSON Tools
We can use a validator to check our JSON files syntax, like JSLint.