Skip to content

Commit

Permalink
Merge "Add a jsonutils file in order to manager imports"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Jun 23, 2015
2 parents 05b0d64 + 9cb0488 commit e69508a
Show file tree
Hide file tree
Showing 19 changed files with 40 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/api-lib/vnc_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import ConfigParser
import pprint
import json
from cfgm_common import jsonutils as json
import sys
import time
import platform
Expand Down
2 changes: 1 addition & 1 deletion src/config/api-server/db_manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import socket
import re
import logging
import json
from cfgm_common import jsonutils as json
from netaddr import IPAddress, IPNetwork
import argparse
from cStringIO import StringIO
Expand Down
2 changes: 1 addition & 1 deletion src/config/api-server/vnc_addr_mgmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from netaddr import *
from vnc_quota import *
from pprint import pformat
import json
from cfgm_common import jsonutils as json
import cfgm_common.exceptions
try:
#python2.7
Expand Down
2 changes: 1 addition & 1 deletion src/config/api-server/vnc_cfg_api_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import signal
import os
import socket
import json
from cfgm_common import jsonutils as json
import uuid
import copy
import argparse
Expand Down
2 changes: 1 addition & 1 deletion src/config/api-server/vnc_cfg_ifmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from cfgm_common.vnc_kombu import VncKombuClient

import copy
import json
from cfgm_common import jsonutils as json
import uuid
import datetime
import pycassa
Expand Down
2 changes: 1 addition & 1 deletion src/config/api-server/vnc_cfg_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# to type of resource. For eg. allocation of mac/ip-addr for a port during its
# creation.

import json
from cfgm_common import jsonutils as json
import re

import cfgm_common
Expand Down
2 changes: 1 addition & 1 deletion src/config/api-server/vnc_perms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
import sys
import json
from cfgm_common import jsonutils as json
import string
from provision_defaults import *
from cfgm_common.exceptions import *
Expand Down
1 change: 1 addition & 0 deletions src/config/common/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ local_sources = [
'zkclient.py',
'exceptions.py',
'utils.py',
'jsonutils.py',
'imid.py',
'svc_info.py',
'vnc_cpu_info.py',
Expand Down
22 changes: 22 additions & 0 deletions src/config/common/jsonutils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# always try to load simplejson first
# as we get better performance
try:
import simplejson as json
except ImportError:
import json


def load(fp, **kwargs):
return json.load(fp, *args, **kwargs)


def loads(s, *args, **kwargs):
return json.loads(s, *args, **kwargs)


def dump(obj, fp, *args, **kwargs):
return json.dump(obj, fp, *args, **kwargs)


def dumps(obj, *args, **kwargs):
return json.dumps(obj, *args, **kwargs)
2 changes: 1 addition & 1 deletion src/config/common/vnc_cassandra.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
ConnectionType
from pysandesh.gen_py.sandesh.ttypes import SandeshLevel
import time
import json
from cfgm_common import jsonutils as json
import utils

class VncCassandraClient(VncCassandraClientGen):
Expand Down
2 changes: 1 addition & 1 deletion src/config/svc-monitor/svc_monitor/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from pysandesh.gen_py.process_info.ttypes import ConnectionStatus

import inspect
import json
from cfgm_common import jsonutils as json
import time


Expand Down
2 changes: 1 addition & 1 deletion src/config/vnc_openstack/vnc_openstack/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#

import sys
import json
from cfgm_common import jsonutils as json
import uuid
import gevent
import gevent.monkey
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import requests
import re
import uuid
import json
from cfgm_common import jsonutils as json
import time
import socket
import netaddr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import bottle
import cgitb
import gevent
import json
from cfgm_common import jsonutils as json
import logging
from pprint import pformat
import requests
Expand Down
2 changes: 1 addition & 1 deletion src/discovery/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import requests
import uuid
import json
from cfgm_common import jsonutils as json
import hashlib
import socket
from disc_utils import *
Expand Down
2 changes: 1 addition & 1 deletion src/discovery/disc_cassdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#

import re
import json
from cfgm_common import jsonutils as json
import time
import gevent
import disc_consts
Expand Down
2 changes: 1 addition & 1 deletion src/discovery/disc_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import signal
import os
import socket
import json
from cfgm_common import jsonutils as json
import xmltodict
import uuid
import copy
Expand Down
2 changes: 1 addition & 1 deletion src/discovery/disc_server_zk.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import signal
import os
import socket
import json
from cfgm_common import jsonutils as json
import xmltodict
import uuid
import copy
Expand Down
2 changes: 1 addition & 1 deletion src/discovery/disc_zk.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import kazoo.recipe.election

import logging
import json
from cfgm_common import jsonutils as json
import time
import disc_consts

Expand Down

0 comments on commit e69508a

Please sign in to comment.