Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions src/cbapi/response/rest_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from distutils.version import LooseVersion
from ..connection import BaseAPI
from .models import Process, Binary, Watchlist, Investigation, Alert, ThreatReport, StoragePartition
from ..errors import UnauthorizedError, ApiError
from ..errors import UnauthorizedError, ApiError, ClientError
from .cblr import LiveResponseSessionManager
from .query import Query

Expand Down Expand Up @@ -49,10 +49,19 @@ def __init__(self, *args, **kwargs):
raise ApiError("CbEnterpriseResponseAPI only supports Cb servers version >= 5.0.0")

self._has_legacy_partitions = False
if self.cb_server_version >= LooseVersion('6.0'):
legacy_partitions = [p for p in self.select(StoragePartition) if p.info.get("isLegacy", False)]
if legacy_partitions:
self._has_legacy_partitions = True
try:
if self.cb_server_version >= LooseVersion('6.0'):
legacy_partitions = [p for p in self.select(StoragePartition) if p.info.get("isLegacy", False)]
if legacy_partitions:
self._has_legacy_partitions = True
except ClientError as ce:
# If we get a 403 on this endpoint, ignore during init,
# as we will not be able to work with StoragePartitions regardless
# https://github.com/carbonblack/cbapi-python/issues/303
if ce.error_code == 403:
pass
else:
raise ce # no intervention

self._lr_scheduler = None

Expand Down