Skip to content

Commit

Permalink
take md5 of cache_id to prevent it from being too long (#259)
Browse files Browse the repository at this point in the history
* take md5 of cache_id to prevent it from being too long

* remove unecessary decode
  • Loading branch information
fabianvf authored Jan 11, 2019
1 parent 84660d7 commit 8abd6a8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions openshift/dynamic/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import sys
import copy
import json
import base64
import hashlib
import tempfile
from functools import partial
from six import PY2, PY3
Expand Down Expand Up @@ -97,7 +97,7 @@ def __init__(self, client, cache_file=None):
default_cache_id = self.configuration.host
if PY3:
default_cache_id = default_cache_id.encode('utf-8')
default_cachefile_name = 'osrcp-{0}.json'.format(base64.b64encode(default_cache_id).decode('utf-8'))
default_cachefile_name = 'osrcp-{0}.json'.format(hashlib.md5(default_cache_id).hexdigest())
self.__resources = ResourceContainer({}, client=self)
self.__cache_file = cache_file or os.path.join(tempfile.gettempdir(), default_cachefile_name)
self.__init_cache()
Expand Down

0 comments on commit 8abd6a8

Please sign in to comment.