8000 Loading client without protobuf will not be blocking · codeplay/cf-python-client@ee0ada4 · GitHub
[go: up one dir, main page]

Skip to content

Commit ee0ada4

Browse files
author
Ben Einaudi
committed
Loading client without protobuf will not be blocking
See cloudfoundry-community#14
1 parent 7b9db1f commit ee0ada4

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

main/cloudfoundry_client/client.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from oauth2_client.credentials_manager import CredentialManager, ServiceInformation
66

77
from cloudfoundry_client.entities import InvalidStatusCode, EntityManager
8-
from cloudfoundry_client.loggregator.loggregator import LoggregatorManager
98
from cloudfoundry_client.v2.apps import AppManager
109
from cloudfoundry_client.v2.buildpacks import BuildpackManager
1110
from cloudfoundry_client.v2.service_bindings import ServiceBindingManager
@@ -38,7 +37,19 @@ def __init__(self, target_endpoint, client_id='cf', client_secret='', proxy=None
3837
self.spaces = EntityManager(target_endpoint, self, '/v2/spaces')
3938
self.services = EntityManager(target_endpoint, self, '/v2/services')
4039
self.routes = EntityManager(target_endpoint, self, '/v2/routes')
41-
self.loggregator = LoggregatorManager(info['logging_endpoint'], self)
40+
try:
41+
from cloudfoundry_client.loggregator.loggregator import LoggregatorManager
42+
self._loggregator = LoggregatorManager(info['logging_endpoint'], self)
43+
except BaseException, ex:
44+
_logger.warning("Error while loading loggregator: %s", ex)
45+
self._loggregator = ex
46+
47+
@property
48+
def loggregator(self):
49+
if isinstance(self._loggregator, BaseException):
50+
raise self._loggregator
51+
else:
52+
return self._loggregator
4253

4354
@staticmethod
4455
def get_info(target_endpoint, proxy=None, skip_verification=False):

0 commit comments

Comments
 (0)
0