Skip to content
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

Fixed the PUBLIC_CLOUD_NAME issue #710

Merged
merged 1 commit into from
Dec 26, 2023
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
5 changes: 3 additions & 2 deletions cloud_governance/main/environment_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ def __init__(self):
self._environment_variables_dict['PUBLIC_CLOUD_NAME'] = EnvironmentVariables.get_env('PUBLIC_CLOUD_NAME', 'AWS')
self._environment_variables_dict['AWS_ACCESS_KEY_ID'] = EnvironmentVariables.get_env('AWS_ACCESS_KEY_ID', '')
self._environment_variables_dict['AWS_SECRET_ACCESS_KEY'] = EnvironmentVariables.get_env('AWS_SECRET_ACCESS_KEY', '')
if EnvironmentVariables.get_env('AWS_ACCESS_KEY_ID', '') and EnvironmentVariables.get_env('AWS_SECRET_ACCESS_KEY', ''):
if self._environment_variables_dict['AWS_ACCESS_KEY_ID'] and \
self._environment_variables_dict['AWS_SECRET_ACCESS_KEY']:
self._environment_variables_dict['PUBLIC_CLOUD_NAME'] = 'AWS'
self._environment_variables_dict['account'] = self.get_aws_account_alias_name().upper().replace('OPENSHIFT-', '')
self._environment_variables_dict['policy'] = EnvironmentVariables.get_env('policy', '')

Expand Down Expand Up @@ -90,7 +92,6 @@ def __init__(self):
self._environment_variables_dict['end_date'] = EnvironmentVariables.get_env('end_date', '')
self._environment_variables_dict['granularity'] = EnvironmentVariables.get_env('granularity', 'DAILY')
self._environment_variables_dict['cost_explorer_tags'] = EnvironmentVariables.get_env('cost_explorer_tags', '{}')
self._environment_variables_dict['PUBLIC_CLOUD_NAME'] = EnvironmentVariables.get_env('PUBLIC_CLOUD_NAME', '')

# AZURE Credentials
self._environment_variables_dict['AZURE_ACCOUNT_ID'] = EnvironmentVariables.get_env('AZURE_ACCOUNT_ID', '')
Expand Down
2 changes: 1 addition & 1 deletion cloud_governance/main/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def main():
ibm_classic_infrastructure_policy_runner = IBMPolicyRunner()

is_cost_explorer_policies_runner = ''
if environment_variables_dict.get('PUBLIC_CLOUD_NAME') == 'AWS':
if environment_variables_dict.get('PUBLIC_CLOUD_NAME').upper() == 'AWS':
cost_explorer_policies_runner = None
is_cost_explorer_policies_runner = policy in environment_variables_dict.get('cost_policies')
if is_cost_explorer_policies_runner:
Expand Down
Loading