From 1e0ef88d570390296f69c78635643b342ccc5624 Mon Sep 17 00:00:00 2001 From: Matt Hart Date: Mon, 7 Sep 2015 12:37:59 +0100 Subject: Added a script to convert bugzilla params files --- README | 9 +++++++++ bugzilla-params.py | 24 ++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100755 bugzilla-params.py diff --git a/README b/README index b4401a5..a390082 100644 --- a/README +++ b/README @@ -1,6 +1,15 @@ Linaro Bugzilla Tools ===================== +bugzilla-params.py: Takes as bugzilla 4.4 perl has params file and +converts it into a bugzilla 5.0 json params file. This is really only +useful when upgrading between these versions. + + +#### Below is obsolete as we deploy bugzilla from ansible-playbooks repo +#### it is left here for reference + + Thie repository contains tools necessary to deploy and configure Linaro bugzilla instance. diff --git a/bugzilla-params.py b/bugzilla-params.py new file mode 100755 index 0000000..ff08d84 --- /dev/null +++ b/bugzilla-params.py @@ -0,0 +1,24 @@ +#!/usr/bin/python + +import sys +import json +import subprocess + +new_file = open(sys.argv[2]).read() + +new_data = json.loads(new_file) + +perl_json = subprocess.Popen('perl -MJSON -le "do shift; print to_json(' + '\%param)" ' + sys.argv[1], shell=True, + stdout=subprocess.PIPE).stdout.read() +old_data = json.loads(perl_json) + +merged_data = {} + +for key, value in new_data.iteritems(): + if key in old_data: + merged_data[key] = old_data[key] + else: + merged_data[key] = new_data[key] + +print json.dumps(merged_data, indent=4, sort_keys=True) -- cgit v1.2.3