Skip to content

Fix error NoneType object error #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 2, 2024
Merged
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
22 changes: 6 additions & 16 deletions src/plugin/manager/advisor/recommendation_cost_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ def create_cloud_service(self, options: dict, secret_data: dict, schema: str):
category = recommendation_info.get("category")
self.cloud_service_type = category

potential_yearly_savings_based_on_retail_pricing = recommendation_info.get("extended_properties").get(
"annualSavingsAmount")
recommendation_info["potential_yearly_savings_based_on_retail_pricing_display"] = float(
potential_yearly_savings_based_on_retail_pricing)
extended_properties = recommendation_info.get("extended_properties", {}) or {}
if extended_properties:
potential_yearly_savings_based_on_retail_pricing = extended_properties.get("annualSavingsAmount")
recommendation_info["potential_yearly_savings_based_on_retail_pricing_display"] = float(
potential_yearly_savings_based_on_retail_pricing)

if recommendation_info.get("impacted_field") == "Microsoft.Subscriptions/subscriptions":
recommendation_info["impacted_value_display"] = recommendation_info.get("subscription_name")
Expand All @@ -65,7 +66,7 @@ def create_cloud_service(self, options: dict, secret_data: dict, schema: str):
)
)
except Exception as e:
_LOGGER.error(f"[create_cloud_service] Error {self.service} {e}")
_LOGGER.error(f"[create_cloud_service] Error {self.service} {e}", exc_info=True)
error_responses.append(
make_error_response(
error=e,
Expand Down Expand Up @@ -93,17 +94,6 @@ def create_cloud_service_type(self):
}
)

@staticmethod
def _create_impact_updates_display(updates: list, impacted_service: str, impacted_region: dict) -> list:
impact_updates_display = []
for update in updates:
update.update(
{"impacted_service_display": impacted_service,
"impacted_region_display": impacted_region.get("impacted_region")}
)
impact_updates_display.append(update)
return impact_updates_display

@staticmethod
def _get_name_from_short_description(short_description: dict) -> str:
return short_description["problem"]
Expand Down
3 changes: 1 addition & 2 deletions src/plugin/metadata/advisor/performance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ table:
- Impact: data.impact
- Description: data.short_description.problem
- Category: data.category
- Potential yearly savings based on retail pricing: data.potential_yearly_savings_based_on_retail_pricing_display
- Impacted resource name: data.impacted_resource_name
- Impacted resource name: data.impacted_value_display
- Impacted resource: data.impacted_field
- Last updated at: data.last_updated

Expand Down
38 changes: 0 additions & 38 deletions src/plugin/metadata/advisor/recommendations.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion src/plugin/metadata/advisor/reliability.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ table:
- Impact: data.impact
- Description: data.short_description.problem
- Category: data.category
- Impacted resource name: data.impacted_value
- Impacted resource name: data.impacted_value_display
- Impacted resource: data.impacted_field
- Last updated at: data.last_updated

Expand Down
8 changes: 4 additions & 4 deletions src/plugin/metadata/advisor/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ table:
key: data.impact
desc: true
fields:
- Recommendation name: data.name
- Impact: data.impact
- Description: data.short_description.problem
- Category: data.category
- Potential benefits: data.potential_benefits
- Last updated at: data.last_update_time
- Impact start time: data.impact_start_time
- End time: data.impact_mitigation_time
- Impacted resource name: data.impacted_value_display
- Impacted resource: data.impacted_field
- Last updated at: data.last_updated


tabs.0:
Expand Down
Loading