Skip to content
Open
Show file tree
Hide file tree
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
9 changes: 5 additions & 4 deletions f5_cccl/bigip.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def refresh_ltm(self):
try:
self._refresh_ltm()
except F5SDKError as error:
LOGGER.error("F5 SDK Error: %s", error)
LOGGER.error("F5 SDK Error: %s", type(error).__name__)
raise cccl_exc.F5CcclCacheRefreshError(
"BigIPProxy: failed to refresh internal BIG-IP ltm state.")

Expand All @@ -147,7 +147,7 @@ def refresh_net(self):
try:
self._refresh_net()
except F5SDKError as error:
LOGGER.error("F5 SDK Error: %s", error)
LOGGER.error("F5 SDK Error: %s", type(error).__name__)
raise cccl_exc.F5CcclCacheRefreshError(
"BigIPProxy: failed to refresh internal BIG-IP net state.")

Expand All @@ -174,7 +174,8 @@ def _create_resource(self, resource_type, resource_obj,
except (ValueError, TypeError) as error:
LOGGER.error(
"Failed to create iControl REST resource %s, %s: error(%s)",
resource_obj.name, resource_type.__name__, str(error))
resource_obj.name, resource_type.__name__,
type(error).__name__)

# An error occurred because the constructor did not like the
# input. Use resource name and partition to allow for its
Expand Down Expand Up @@ -453,7 +454,7 @@ def get_default_route_domain(self):
# Note: This information is needed when processing the request config
# which occurs before self.refresh() is called
except Exception as error:
LOGGER.error("F5 SDK Error: %s", error)
LOGGER.error("F5 SDK Error: %s", type(error).__name__)
raise cccl_exc.F5CcclResourceNotFoundError(
f"The requested partition {self._partition} was not found.")

Expand Down
12 changes: 7 additions & 5 deletions f5_cccl/resource/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def __lt__(self, resource):
return self.full_path() < resource.full_path()

def __str__(self):
return str(self._data)
return "{} /{}/{}".format(self.classname(), self.partition, self.name)

def merge(self, desired_data):
"""Merge in properties from controller instead of replacing"""
Expand Down Expand Up @@ -384,14 +384,16 @@ def _handle_http_error(self, error):
LOGGER.error(
"HTTP error(%d): CCCL resource(%s) /%s/%s.",
code, self.classname(), self.partition, self.name)
sanitized = "HTTP {} for /{}/{}".format(
code, self.partition, self.name)
if code == 404:
raise cccl_exc.F5CcclResourceNotFoundError(str(error))
raise cccl_exc.F5CcclResourceNotFoundError(sanitized)
elif code == 409:
raise cccl_exc.F5CcclResourceConflictError(str(error))
raise cccl_exc.F5CcclResourceConflictError(sanitized)
elif 400 <= code < 500:
raise cccl_exc.F5CcclResourceRequestError(str(error))
raise cccl_exc.F5CcclResourceRequestError(sanitized)
else:
raise cccl_exc.F5CcclError(str(error))
raise cccl_exc.F5CcclError(sanitized)

def _process_metadata_flags(self, name, metadata_list):
# look for supported flags
Expand Down