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

pre-commit: end-of-file-fixer #790

Merged
merged 1 commit into from
Jun 4, 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
2 changes: 1 addition & 1 deletion .coveralls.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
service_name: travis-pro
parallel: true
parallel: true
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ If applicable, add screenshots to help explain your problem.
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
Add any other context about the problem here.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ A clear and concise description of what you want to happen.
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
Add any other context or screenshots about the feature request here.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ repos:
- id: check-json
- id: check-yaml
- id: trailing-whitespace
- id: end-of-file-fixer
2 changes: 1 addition & 1 deletion cloud_governance/cloud_resource_orchestration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ To start **cloud_resource_orchestration** CI run the below podman command

```commandline
podman run --net="host" --rm --name cloud_resource_orchestration -e AWS_DEFAULT_REGION="ap-south-1" -e CLOUD_RESOURCE_ORCHESTRATION="True" -e account="$account" -e AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID" -e AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY" -e PUBLIC_CLOUD_NAME="$PUBLIC_CLOUD_NAME" -e es_host="$ES_HOST" -e es_port="$ES_PORT" -e CRO_ES_INDEX="$CRO_ES_INDEX" -e log_level="INFO" -e LDAP_HOST_NAME="$LDAP_HOST_NAME" -e JIRA_QUEUE="$JIRA_QUEUE" -e JIRA_TOKEN="$JIRA_TOKEN" -e JIRA_USERNAME="$JIRA_USERNAME" -e JIRA_URL="$JIRA_URL" -e CRO_COST_OVER_USAGE="$CRO_COST_OVER_USAGE" -e CRO_PORTAL="$CRO_PORTAL" -e CRO_DEFAULT_ADMINS="$CRO_DEFAULT_ADMINS" -e CRO_REPLACED_USERNAMES="$CRO_REPLACED_USERNAMES" -e CRO_DURATION_DAYS="30" quay.io/ebattat/cloud-governance:latest
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -329,4 +329,3 @@ def run(self, monitor_data: dict):
result = self.__upload_cro_report_to_es(monitor_data=monitor_data)
handler.setLevel(logging.WARN)
return result

Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,3 @@ def run(self):
:return:
# """
self.monitor_tickets()




Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,3 @@ def _get_cost_based_on_tag(self, start_date: str, end_date: str, tag_name: str,
response = self.__cost_mgmt_operations.get_filter_data(cost_data=results_by_time, tag_name=tag_name)
return response
return {}

Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ def execute_query(self, query_string: str):
:return:
"""
raise NotImplemented()

Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,3 @@ def get_billing_profiles_list(self, subscription_id: str = ''):
else:
billing_profiles.append(response.id)
return billing_profiles





Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ class ElasticSearchDataNotUploaded(ElasticSearchError):
"""This exception return elastic search not uploaded error"""
def __init__(self):
self.message = f'Data did not upload to elastic search'
super(ElasticSearchDataNotUploaded, self).__init__(self.message)
super(ElasticSearchDataNotUploaded, self).__init__(self.message)
1 change: 0 additions & 1 deletion cloud_governance/common/jira/jira_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,4 +323,3 @@ def get_total_extend_duration(self, sub_ticket_ids: list):
description = self.get_issue_description(ticket_id=sub_ticket_id, sub_task=True)
total_duration += int(description.get('Days', 0))
return total_duration

1 change: 0 additions & 1 deletion cloud_governance/common/logger/init_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@

# def get_pyperf_log_path():
# return f'{log_path}/py_perf.log'

1 change: 0 additions & 1 deletion cloud_governance/policy/azure/cleanup/instance_idle.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,3 @@ def run_policy_operations(self):
self.update_resource_day_count_tag(resource_id=vm.get("id"), cleanup_days=cleanup_days,
tags=tags)
return running_vms

1 change: 0 additions & 1 deletion cloud_governance/policy/azure/cleanup/unattached_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,3 @@ def run_policy_operations(self):
self.update_resource_day_count_tag(resource_id=volume.get("id"), cleanup_days=cleanup_days, tags=tags)

return unattached_volumes

Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,3 @@ def remove_cluster_resources_tags(region: str, cluster_name: str, input_tags: di
for func in func_resource_list[1:]:
func(instance_tags=response)
logger.info(response)

Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,3 @@ def tag_na_resources(file_name: str, file_path: str = '/tmp/', tag_operation: st
update_na_tags.create_csv()
elif tag_operation == 'update':
update_na_tags.update_tags()

Original file line number Diff line number Diff line change
Expand Up @@ -288,4 +288,3 @@ def _check_zombie_cluster_deleted_days(self, resources: dict, cluster_left_out_d
if cluster_delete_days >= self.DAYS_TO_DELETE_RESOURCE:
delete_cluster_resource = True
return cluster_left_out_days, delete_cluster_resource

Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@ def scan_repo(self):
# # save local
# else:
# os.replace(self.__resources_file_full_path, fr'{policy_output}/{self.__resource_file_name}')
# self.__delete_gitleaks_resource()
# self.__delete_gitleaks_resource()
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,3 @@ def __init__(self):
self._dry_run = self.__environment_variables_dict.get('dry_run', 'yes')
self._policy = self.__environment_variables_dict.get('policy', '')
self._tag_operation = self.__environment_variables_dict.get('tag_operation', 'read')




Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,3 @@ def execute_policy(self, policy_class_name: str, run_policy: Callable, upload: b
self._upload_elastic_search.upload(data=response)
upload_to_s3.upload(data=response)
return policy_result

Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,3 @@ def run(self, source: str = "", upload: bool = True):
if self._save_to_file_path:
self.write_to_file(data=policy_result)
return policy_result

Original file line number Diff line number Diff line change
Expand Up @@ -632,4 +632,4 @@
"z1d.large": 0.186,
"z1d.metal": 4.464,
"z1d.xlarge": 0.372
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ SAS
SHIFT ON STACK
TELCO 5G
TOOL
APPLICATION MANAGED SERVCES
APPLICATION MANAGED SERVCES
2 changes: 1 addition & 1 deletion cloudsensei/email_template.j2
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
{% endfor %}
</tbody>
</table>
</div>
</div>
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

nbsphinx_execute = "always"
nbsphinx_execute = "always"
2 changes: 1 addition & 1 deletion docs/source/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
* Create a logs bucket [create_bucket.sh](iam/cloud/aws/create_bucket.sh)

### IBM Configuration
* Create classic infrastructure API key
* Create classic infrastructure API key
3 changes: 0 additions & 3 deletions docs/source/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,3 @@ pod
pytest
postinstallation
```



2 changes: 1 addition & 1 deletion docs/source/podman.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ podman run --rm --name cloud-governance -e policy="tag_baremetal" -e account="$a
# tag=tab_vm
podman run --rm --name cloud-governance -e policy="tag_vm" -e account="$account" -e IBM_API_USERNAME="$IBM_API_USERNAME" -e IBM_API_KEY="$IBM_API_KEY" -e SPREADSHEET_ID="$SPREADSHEET_ID" -e GOOGLE_APPLICATION_CREDENTIALS="$GOOGLE_APPLICATION_CREDENTIALS" -v $GOOGLE_APPLICATION_CREDENTIALS:$GOOGLE_APPLICATION_CREDENTIALS -e LDAP_USER_HOST="$LDAP_USER_HOST" -e tag_operation="update" -e log_level="INFO" -v "/etc/localtime":"/etc/localtime" "quay.io/ebattat/cloud-governance:latest"

```
```
3 changes: 0 additions & 3 deletions docs/source/tagging.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,3 @@ sudo podman run --rm --name cloud-governance -e policy=tag_resources -e AWS_ACCE
# policy=tag_non_cluster
sudo podman run --rm --name cloud-governance -e policy=tag_non_cluster -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY -e AWS_DEFAULT_REGION=us-east-2 -e dtag_operation=read/delete/update -e mandatory_tags="{'Owner': 'Name','Email': '[email protected]','Purpose': 'test'}" -e log_level=INFO -v /etc/localtime:/etc/localtime quay.io/ebattat/cloud-governance
```



2 changes: 1 addition & 1 deletion grafana/clouds/aws/aws_global_dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -3342,4 +3342,4 @@
"uid": "1v8k9u6nz",
"version": 98,
"weekStart": ""
}
}
2 changes: 1 addition & 1 deletion grafana/clouds/aws/cost_explorer_main.json
Original file line number Diff line number Diff line change
Expand Up @@ -4670,4 +4670,4 @@
"uid": "3vqJes5Vk",
"version": 60,
"weekStart": ""
}
}
2 changes: 1 addition & 1 deletion grafana/clouds/aws/payer_account_billing_reports.json
Original file line number Diff line number Diff line change
Expand Up @@ -1225,4 +1225,4 @@
"uid": "ckeZn1o4k",
"version": 59,
"weekStart": ""
}
}
2 changes: 1 addition & 1 deletion grafana/clouds/ibm/ibm_global_dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -1045,4 +1045,4 @@
"uid": "dvtz2vHVz",
"version": 3,
"weekStart": ""
}
}
2 changes: 1 addition & 1 deletion how_to_add_aws_account
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
3. Add 3 secrets in jenkins credentials (access-key-id, secret-access-key, bucket)
4. Add secrets to 3 files: Jenkinsfile, run_policies, run_upload_es - change: account/AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY
5. Add account url in source: https://source.redhat.com/groups/public/cloudgovernance
6. Create account dashboard
6. Create account dashboard
2 changes: 1 addition & 1 deletion iam/clouds/aws/create_bucket.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ aws s3api put-object --bucket <bucket-name> --key logs
aws s3 ls s3://<bucket-name>

# delete bucket
aws s3api delete-bucket --bucket <bucket-name> --region us-east-2
aws s3api delete-bucket --bucket <bucket-name> --region us-east-2
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
"Resource": "*"
}
]
}
}
2 changes: 1 addition & 1 deletion iam/clouds/aws/delete/CloudGovernanceIAMPolicy
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@
"Resource": "*"
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
"Resource": "*"
}
]
}
}
2 changes: 1 addition & 1 deletion iam/clouds/aws/not_delete/CloudGovernanceIAMPolicy
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@
"Resource": "*"
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@
"Resource": "*"
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
"Action": "sts:AssumeRole"
}
]
}
}
2 changes: 1 addition & 1 deletion iam/clouds/aws/payer_roles/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ Then share your **AccountId** and **Role Name** to the users for accessing the
To delete the IAM policy through terraform.
```commandline
terraform delete
```
```
1 change: 0 additions & 1 deletion jenkins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,3 @@ Goto IAM Services to create policy and user
}
}
```

2 changes: 1 addition & 1 deletion jenkins/Step_by_Step.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,4 @@
2. Update Credentials
1. Select the secret you want to upgrade.
2. If it is a file secret.
3. Upload the modified file.
3. Upload the modified file.
3 changes: 0 additions & 3 deletions pod_yaml/cloud-governance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,3 @@ spec:
image: quay.io/ebattat/cloud-governance
name: cloud-governance
restartPolicy: OnFailure



2 changes: 1 addition & 1 deletion pod_yaml/cloud_governance_secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ metadata:
name: cloud-governance-secret
data:
aws_access_key_id: awsaccesskeyid
aws_secret_access_key: awssecretaccesskey
aws_secret_access_key: awssecretaccesskey
2 changes: 1 addition & 1 deletion pod_yaml/quayio_secret.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
podman login --authfile=quayioconfig.json quay.io
oc create secret generic quayiosecret --from-file=.dockerconfigjson=quayioconfig.json --type=kubernetes.io/dockerconfigjson
oc secrets link default quayiosecret --for=pull
oc secrets link builder quayiosecret
oc secrets link builder quayiosecret
2 changes: 1 addition & 1 deletion pod_yaml/upload_quayio
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# sudo podman build --layers=false -t cloud-governance:v1.0.190 .
# sudo podman login quay.io
# sudo podman push localhost/cloud-governance:v1.0.105 quay.io/ebattat/cloud-governance
# sudo podman pull quay.io/ebattat/cloud-governance
# sudo podman pull quay.io/ebattat/cloud-governance
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,3 @@ def test_ec2_zombie_vpc_delete():
resource_name='zombie_cluster_vpc', force_delete=True)
zombie_cluster_resources.zombie_cluster_vpc()
assert not EC2Operations().find_vpc('kubernetes.io/cluster/integration-test-cluster')

Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,3 @@ def test_s3_zombie_bucket_delete():
zombie_cluster_resources.zombie_cluster_s3_bucket()
s3_operations = S3Operations(region_name='us-east-1')
assert not s3_operations.find_bucket(bucket_name=BUCKET_NAME)






Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,3 @@ def test_query_list():
gcp_account = GoogleAccount()
result_year_month = gcp_account.query_list([fetch_query])[0][0].get('month')
assert result_year_month == year_month

Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,3 @@ def test_upload_data():
'Username': 'cloud-governance-user-test'
}]
assert 1 == dynamo_db._upload_to_dynamo_db_table(data=mock_log_data)






Original file line number Diff line number Diff line change
Expand Up @@ -184,4 +184,3 @@ def test_not_delete_iam_cluster_user():
find = True
break
assert find

Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,3 @@ def test_verify_active():
def test_verify_non_active():
cost_over_usage = CostOverUsage()
assert not cost_over_usage._verify_active_resources(tag_value='user', tag_name='test')

Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,3 @@ def test_monitor_management_operations__get_audit_records():
monitor_operations = MonitorManagementOperations()

assert len(monitor_operations.get_audit_records(resource_id=AZURE_RESOURCE_ID)) == 1


Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ def test_post_query():
response = es_operations.post_query(es_index=es_index, query=query)
assert response
except TypeError:
assert TypeError
assert TypeError
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,3 @@ def test_update_resource_day_count_tag_updated_tag_today():
instances = ec2_client.describe_instances()['Reservations']
tag_value = aws_cleanup_operations.get_tag_name_from_tags(instances[0]['Instances'][0].get('Tags'), tag_name='DaysCount')
assert tag_value == str(datetime.datetime.utcnow().date()) + "@1"

2 changes: 0 additions & 2 deletions tests/unittest/mocks/azure/common_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,3 @@ class CustomItemPaged(ItemPaged):
def __init__(self, resource_list: list = None):
super().__init__()
self._page_iterator = iter(resource_list if resource_list else [])


Loading