diff options
| author | Keith Wall <kwall@apache.org> | 2014-12-23 13:13:28 +0000 |
|---|---|---|
| committer | Keith Wall <kwall@apache.org> | 2014-12-23 13:13:28 +0000 |
| commit | a4c8c2bb51bda9f724d21e68546c7a23727e33bd (patch) | |
| tree | 73bd2ca4cd46a12b2456d4c7487d00af5639ac7f /qpid/java | |
| parent | 018bdbaedeb39743dce1024a6064636b19810610 (diff) | |
| download | qpid-python-a4c8c2bb51bda9f724d21e68546c7a23727e33bd.tar.gz | |
QPID-6284: [Java Broker Tests] Make json_config_tool.py compatible with Python 2.6 (avoid argparse)
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1647568 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
| -rwxr-xr-x | qpid/java/perftests/etc/json_config_tool.py | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/qpid/java/perftests/etc/json_config_tool.py b/qpid/java/perftests/etc/json_config_tool.py index 21fc0aa786..38a994f81b 100755 --- a/qpid/java/perftests/etc/json_config_tool.py +++ b/qpid/java/perftests/etc/json_config_tool.py @@ -22,7 +22,29 @@ from StringIO import StringIO import json import sys import re -import argparse + +objname = None +attrname = None +attrvalue = None + +try: + import argparse + + parser = argparse.ArgumentParser(description='Adds (or updates) a attribute name/value pair of an existing object within a Java Broker config.json') + parser.add_argument("objectname", help='Name of the object e.g. httpManagement') + parser.add_argument("attrname", help='Name of the attribute to add or update e.g. httpBasicAuthenticationEnabled') + parser.add_argument("attrvalue", help='Value of the attribute e.g. true') + args = parser.parse_args() + + objname = args.objectname + attrname = args.attrname + attrvalue = args.attrvalue +except ImportError: + objname = sys.argv[1] + attrname = sys.argv[2] + attrvalue = sys.argv[3] + pass + def transform(data): if isinstance(data, tuple): @@ -37,17 +59,6 @@ def transform(data): else: return data - -parser = argparse.ArgumentParser(description='Adds (or updates) a attribute name/value pair of an existing object within a Java Broker config.json') -parser.add_argument("objectname", help='Name of the object e.g. httpManagement') -parser.add_argument("attrname", help='Name of the attribute to add or update e.g. httpBasicAuthenticationEnabled') -parser.add_argument("attrvalue", help='Value of the attribute e.g. true') -args = parser.parse_args() - -objname = args.objectname -attrname = args.attrname -attrvalue = args.attrvalue - # Expects a config.json to be provided on stdin, write the resulting json to stdout. lines = [] |
