Compare configuration files before and after upgrade

Compare configuration files before and after upgrade

Script to compare the same files in 2 directories.

List of files that need to be compared needs to passed as a separate file

The script takes input from the user for the current directory, backup directory and file location containing file paths

The file formats supported by the script are .json, .js, and conf files with format (key=value) and (key value)

Download the file

wget https://cvs-iwx.s3.amazonaws.com/scripts/compare.py

Run the compare.py

python compare.py

Example for JSON file containing the list of files and locations that have to be compared

{ "conf.properties": "conf/conf.properties", "dataproc_defaults.json": "conf/dataproc_defaults.json", "airflow.cfg": "orchestrator-engine/airflow.cfg", "ecosystem.config.js": "platform/rest-api-service/ecosystem.config.js", ".env": "platform/rest-api-service/.env", "exporter.conf": "resources/nginx-portable/conf/infoworks/extras/exporter.conf", "config-dev.json": "platform/conf/config-dev.json", "nginx.conf": "resources/nginx-portable/conf/nginx.conf", "platform.conf.template": "resources/nginx-portable/conf/infoworks/platform.conf.template", "pg_hba.conf": "resources/postgres/pgsql/data/pg_hba.conf", "dt_spark_defaults.conf": "conf/dt_spark_defaults.conf" }

Example output

Enter current installation directory [# Example : /opt/infoworks] : /opt/infoworks Enter backup directory [# Example : /opt/infoworks_5306] : /opt/infoworks_5306 Enter file path for JSON file containing file paths: /opt/infoworks/scripts/file_path.json Value mismatch for key 'default_driver_xmx_mb' in conf/conf.properties: '2048' in current dir and '512' in backup Value mismatch for key 'ingestion_port' in conf/conf.properties: '3025' in current dir and '3026' in backup Key 'example' is present in conf/conf.properties of current dir but not present in backup Key 'demo' is present in backup conf/conf.properties but not present in current dir List length mismatch for key 'init_scripts' in dataproc_defaults.json: 3 in current dir and 1 in backup Value mismatch for key 'imageVersion' in dataproc_defaults.json: '2.0.53-ubuntu18' in current dir and '1.4-ubuntu18' in backup Value mismatch for key 'parallelism ' in orchestrator-engine/airflow.cfg: ' 2' in current dir and ' 15' in backup Value mismatch for key 'worker_concurrency ' in orchestrator-engine/airflow.cfg: ' 2' in current dir and ' 15' in backup Value mismatch for key 'job_heartbeat_sec ' in orchestrator-engine/airflow.cfg: ' 2' in current dir and ' 3' in backup Value mismatch for key 'min_file_process_interval ' in orchestrator-engine/airflow.cfg: ' 5' in current dir and ' 900' in backup Value mismatch for key 'instances:' in platform/rest-api-service/ecosystem.config.js: '4,' in current dir and '2,' in backup Value mismatch for key 'max_memory_restart:' in platform/rest-api-service/ecosystem.config.js: ''2G',' in current dir and ''1G',' in backup Value mismatch for key 'TIMEOUT' in platform/rest-api-service/.env: '100000' in current dir and '20000' in backup

Author: Anirudh Chekuri

Date Published: 04/12/2023