aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhongyuzhao <zhao.hongyu@zte.com.cn>2020-02-04 17:46:11 +0800
committerhongyuzhao <zhao.hongyu@zte.com.cn>2020-02-04 17:48:25 +0800
commitdddb97b7f1d5ac85c4700a674e9cadcdb7ac2b63 (patch)
tree1ae3dc63c310aedbebf6f68e9b4d001d90520b4a
parent3d10bac5ec6b5394d32dc6ad3b0a7e6294ea6593 (diff)
Remove redis config
Change-Id: I419fb5d39a46a9ca2b9a74f2a4d6d4ff12101d03 Issue-ID: MODELING-307 Signed-off-by: hongyuzhao <zhao.hongyu@zte.com.cn>
-rw-r--r--catalog/pub/config/config.py6
-rw-r--r--catalog/pub/redisco/__init__.py58
-rw-r--r--catalog/pub/redisco/containers.py116
-rwxr-xr-xdocker/instance_config.sh12
-rw-r--r--requirements.txt4
5 files changed, 11 insertions, 185 deletions
diff --git a/catalog/pub/config/config.py b/catalog/pub/config/config.py
index 3f6592a..4ca1d5d 100644
--- a/catalog/pub/config/config.py
+++ b/catalog/pub/config/config.py
@@ -17,9 +17,9 @@ MSB_SERVICE_IP = '127.0.0.1'
MSB_SERVICE_PORT = '80'
# [REDIS]
-REDIS_HOST = '127.0.0.1'
-REDIS_PORT = '6379'
-REDIS_PASSWD = ''
+# REDIS_HOST = '127.0.0.1'
+# REDIS_PORT = '6379'
+# REDIS_PASSWD = ''
# [mysql]
DB_IP = "127.0.0.1"
diff --git a/catalog/pub/redisco/__init__.py b/catalog/pub/redisco/__init__.py
deleted file mode 100644
index 217a232..0000000
--- a/catalog/pub/redisco/__init__.py
+++ /dev/null
@@ -1,58 +0,0 @@
-# Copyright (c) 2010 Tim Medina
-#
-# Permission is hereby granted, free of charge, to any person
-# obtaining a copy of this software and associated documentation
-# files (the "Software"), to deal in the Software without
-# restriction, including without limitation the rights to use,
-# copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following
-# conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-# OTHER DEALINGS IN THE SOFTWARE.
-#
-# The original code link is https://github.com/iamteem/redisco/tree/master/redisco/__init__.py
-
-
-import redis
-
-
-class Client(object):
- def __init__(self, **kwargs):
- self.connection_settings = kwargs or {'host': 'localhost', 'port': 6379, 'db': 0}
-
- def redis(self):
- return redis.Redis(**self.connection_settings)
-
- def update(self, d):
- self.connection_settings.update(d)
-
-
-def connection_setup(**kwargs):
- global connection, client
- if client:
- client.update(kwargs)
- else:
- client = Client(**kwargs)
- connection = client.redis()
-
-
-def get_client():
- global connection
- return connection
-
-
-client = Client()
-connection = client.redis()
-
-__all__ = ['connection_setup', 'get_client']
diff --git a/catalog/pub/redisco/containers.py b/catalog/pub/redisco/containers.py
deleted file mode 100644
index d30c227..0000000
--- a/catalog/pub/redisco/containers.py
+++ /dev/null
@@ -1,116 +0,0 @@
-# Copyright (c) 2010 Tim Medina
-#
-# Permission is hereby granted, free of charge, to any person
-# obtaining a copy of this software and associated documentation
-# files (the "Software"), to deal in the Software without
-# restriction, including without limitation the rights to use,
-# copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following
-# conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-# OTHER DEALINGS IN THE SOFTWARE.
-#
-# The original code link is https://github.com/iamteem/redisco/tree/master/redisco/containers.py
-
-"""
-This module contains the container classes to create objects
-that persist directly in a Redis server.
-"""
-
-import collections
-from functools import partial
-
-
-class Container(object):
- """Create a container object saved in Redis.
-
- Arguments:
- key -- the Redis key this container is stored at
- db -- the Redis client object. Default: None
-
- When ``db`` is not set, the gets the default connection from
- ``redisco.connection`` module.
- """
-
- def __init__(self, key, db=None, pipeline=None):
- self._db = db
- self.key = key
- self.pipeline = pipeline
-
- def clear(self):
- """Remove container from Redis database."""
- del self.db[self.key]
-
- def __getattribute__(self, att):
- if att in object.__getattribute__(self, 'DELEGATEABLE_METHODS'):
- return partial(getattr(object.__getattribute__(self, 'db'), att), self.key)
- else:
- return object.__getattribute__(self, att)
-
- @property
- def db(self):
- if self.pipeline:
- return self.pipeline
- if self._db:
- return self._db
- if hasattr(self, 'db_cache') and self.db_cache:
- return self.db_cache
- else:
- from . import connection
- self.db_cache = connection
- return self.db_cache
-
- DELEGATEABLE_METHODS = ()
-
-
-class Hash(Container, collections.MutableMapping):
-
- def __getitem__(self, att):
- return self.hget(att)
-
- def __setitem__(self, att, val):
- self.hset(att, val)
-
- def __delitem__(self, att):
- self.hdel(att)
-
- def __len__(self):
- return self.hlen()
-
- def __iter__(self):
- return self.hgetall().__iter__()
-
- def __contains__(self, att):
- return self.hexists(att)
-
- def __repr__(self):
- return "<%s '%s' %s>" % (self.__class__.__name__, self.key, self.hgetall())
-
- def keys(self):
- return self.hkeys()
-
- def values(self):
- return self.hvals()
-
- def _get_dict(self):
- return self.hgetall()
-
- def _set_dict(self, new_dict):
- self.clear()
- self.update(new_dict)
-
- dict = property(_get_dict, _set_dict)
-
- DELEGATEABLE_METHODS = ('hlen', 'hset', 'hdel', 'hkeys', 'hgetall', 'hvals',
- 'hget', 'hexists', 'hincrby', 'hmget', 'hmset')
diff --git a/docker/instance_config.sh b/docker/instance_config.sh
index ebc785a..bc5c02b 100755
--- a/docker/instance_config.sh
+++ b/docker/instance_config.sh
@@ -20,15 +20,15 @@ MYSQL_IP=`echo $MYSQL_ADDR | cut -d: -f 1`
MYSQL_PORT=`echo $MYSQL_ADDR | cut -d: -f 2`
echo "MYSQL_ADDR=$MYSQL_ADDR"
-if [ $REDIS_ADDR ]; then
- REDIS_IP=`echo $REDIS_ADDR | cut -d: -f 1`
-else
- REDIS_IP="$MYSQL_ADDR"
-fi
+# if [ $REDIS_ADDR ]; then
+# REDIS_IP=`echo $REDIS_ADDR | cut -d: -f 1`
+# else
+# REDIS_IP="$MYSQL_ADDR"
+# fi
sed -i "s|DB_IP.*|DB_IP = '$MYSQL_IP'|" modeling/etsicatalog/catalog/pub/config/config.py
sed -i "s|DB_PORT.*|DB_PORT = $MYSQL_PORT|" modeling/etsicatalog/catalog/pub/config/config.py
-sed -i "s|REDIS_HOST.*|REDIS_HOST = '$REDIS_IP'|"modeling/etsicatalog/catalog/pub/config/config.py
+# sed -i "s|REDIS_HOST.*|REDIS_HOST = '$REDIS_IP'|"modeling/etsicatalog/catalog/pub/config/config.py
cat modeling/etsicatalog/catalog/pub/config/config.py
diff --git a/requirements.txt b/requirements.txt
index 5959924..6e8880a 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -6,11 +6,11 @@ djangorestframework==3.10.3
PyMySQL==0.9.3
# redis cache
-redis==2.10.5
+# redis==2.10.5
# for access redis cache
# redisco==0.1.4
-django-redis-cache==0.13.1
+# django-redis-cache==0.13.1
# for call rest api
httplib2==0.12.3