Skip to content

Commit

Permalink
Merge pull request #108 from stat-kwon/master
Browse files Browse the repository at this point in the history
Fix SKIP logic in manager because of Disabled service
  • Loading branch information
stat-kwon authored Jan 24, 2024
2 parents 1f4b27c + efd0f37 commit 26a3dc7
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions src/spaceone/inventory/libs/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,28 @@ def collect_resources(self, params) -> list:
total_resources.extend(self.collect_region())

except Exception as e:
if (
isinstance(e, HttpError)
and e.status_code == 403
and e.error_details[1]["reason"] == "SERVICE_DISABLED"
):
_LOGGER.error(f"[collect_resources] SKIP Disabled Service {e}")
pass
if isinstance(e, HttpError) and e.status_code == 403:
if (
len(e.error_details) == 1
and e.error_details[0].get("reason") == "accessNotConfigured"
):
_LOGGER.error(f"[collect_resources] SKIP Disabled Service {e}")
pass
elif (
len(e.error_details) == 2
and e.error_details[1].get("reason") == "SERVICE_DISABLED"
):
_LOGGER.error(f"[collect_resources] SKIP Disabled Service {e}")
pass
else:
_LOGGER.error(f"[collect_resources] {e}", exc_info=True)
error_resource_response = self.generate_error_response(
e,
self.cloud_service_types[0].resource.group,
self.cloud_service_types[0].resource.name,
)

total_resources.append(error_resource_response)
else:
_LOGGER.error(f"[collect_resources] {e}", exc_info=True)
error_resource_response = self.generate_error_response(
Expand Down

0 comments on commit 26a3dc7

Please sign in to comment.