From 49b2d05bee661e11658e2ac78fcb8b6e3478cd69 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Sat, 10 Apr 2021 17:13:00 +0300
Subject: [PATCH] Address pre-commit issues.

- Bandit complains on using urlopen, ignore since I'm using a hard-coded
URL.
- Pylint complains on the module name, rename.
- Remove the docker-compose hook, no docker-compose.yml.
---
 .pre-commit-config.yaml                | 2 --
 deduce-aws-region => deduce_aws_region | 2 +-
 entrypoint                             | 2 +-
 3 files changed, 2 insertions(+), 4 deletions(-)
 rename deduce-aws-region => deduce_aws_region (88%)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 16add03..f2fe655 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -45,8 +45,6 @@ repos:
     rev: v0.3.0
     hooks:
       - id: hadolint
-      - id: docker-compose
-
 
   - repo: https://github.com/ambv/black
     rev: 20.8b1
diff --git a/deduce-aws-region b/deduce_aws_region
similarity index 88%
rename from deduce-aws-region
rename to deduce_aws_region
index 75d45c3..f616d76 100755
--- a/deduce-aws-region
+++ b/deduce_aws_region
@@ -4,7 +4,7 @@ from urllib.request import urlopen
 import json
 
 if __name__ == "__main__":
-    response = urlopen(
+    response = urlopen(  # nosec
         "http://169.254.169.254/latest/dynamic/instance-identity/document"
     )
     print(json.loads(response.read().decode("utf-8"))["region"])
diff --git a/entrypoint b/entrypoint
index 86da6d3..d1dcacd 100755
--- a/entrypoint
+++ b/entrypoint
@@ -3,7 +3,7 @@ set -eux
 template /var/awslogs/etc/awslogs.conf.j2 > /tmp/config
 if [ -z "${AWS_DEFAULT_REGION:-}" ]
 then
-    AWS_DEFAULT_REGION="$(deduce-aws-region)"
+    AWS_DEFAULT_REGION="$(deduce_aws_region)"
     export AWS_DEFAULT_REGION
 fi
 eval exec "$@"
-- 
GitLab