From 2e99c350493014e2971d7278cdfc923d92bb1e4e 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. --- .dockerignore | 2 +- .pre-commit-config.yaml | 2 -- Dockerfile | 2 +- deduce-aws-region => deduce_aws_region | 2 +- entrypoint | 2 +- 5 files changed, 4 insertions(+), 6 deletions(-) rename deduce-aws-region => deduce_aws_region (88%) diff --git a/.dockerignore b/.dockerignore index e407a3a..c73c221 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,5 @@ * !awslogs.conf !config -!deduce-aws-region +!deduce_aws_region !entrypoint 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/Dockerfile b/Dockerfile index 61b8321..b3e39ae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ RUN pip install --no-cache-dir --progress-bar=off \ COPY --chown=root:root config /etc/aws/ COPY --chown=root:root entrypoint /usr/local/bin/ COPY --chown=root:root awslogs.conf /var/awslogs/etc/awslogs.conf.j2 -COPY --chown=root:root deduce-aws-region /usr/local/bin/ +COPY --chown=root:root deduce_aws_region /usr/local/bin/ USER nobody ENV AWS_CONFIG_FILE="/etc/aws/config" \ LOG_GROUP_NAME="" \ 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