From c6b06b55d9c88a95373c0ebb913f9f6bbdd5b452 Mon Sep 17 00:00:00 2001 From: asalajan Date: Tue, 1 Aug 2023 16:03:48 +0300 Subject: [PATCH] Update ansible and dependencies (#144) * Update ansible and dependencies * Use latest python for build --- Dockerfile | 4 ++-- README.md | 2 -- build_scripts/freeze_requirements.sh | 3 ++- build_scripts/run_tests.sh | 0 requirements.txt | 13 ++++++------- setup.py | 6 ++---- src/ops/cli/config.py | 6 +++++- tests/e2e/fixture/ansible/ansible.cfg | 2 +- .../e2e/fixture/ansible/clusters/test_filters.yaml | 2 +- .../fixture/terraform/terraform/main/main.tf.jinja2 | 3 ++- 10 files changed, 21 insertions(+), 20 deletions(-) mode change 100644 => 100755 build_scripts/run_tests.sh diff --git a/Dockerfile b/Dockerfile index cb00a8b9..911582be 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3-alpine3.13 AS compile-image +FROM python:3.11.4-alpine3.18 AS compile-image ARG TERRAFORM_VERSION="0.12.6" ARG AZURE_CLI_VERSION="2.0.67" @@ -23,7 +23,7 @@ RUN bash build_scripts/build_package.sh RUN apk del --purge build -FROM python:3.7-alpine3.10 +FROM python:3.11.4-alpine3.18 ARG TERRAFORM_VERSION="0.12.6" ARG VAULT_VERSION="1.1.3" ARG KUBECTL_VERSION="v1.17.0" diff --git a/README.md b/README.md index 034c10cc..08a4e9bb 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -**!!! NOT MAINTAINED ANYMORE - DO NOT USE IT !!** - # Ops CLI [![Build status](https://github.com/adobe/ops-cli/actions/workflows/release.yml/badge.svg)](https://github.com/adobe/ops-cli/actions/workflows/release.yml) [![Docker image](https://img.shields.io/badge/Docker-ghcr.io/adobe/opscli-brightgreen.svg?style=flat-square)](https://github.com/adobe/ops-cli/pkgs/container/ops-cli) [![License](https://img.shields.io/github/license/adobe/ops-cli)](https://github.com/adobe/ops-cli/blob/master/LICENSE) diff --git a/build_scripts/freeze_requirements.sh b/build_scripts/freeze_requirements.sh index 55b72a68..131923f4 100644 --- a/build_scripts/freeze_requirements.sh +++ b/build_scripts/freeze_requirements.sh @@ -5,6 +5,7 @@ echo "Freezing requirements.txt" pip install pipenv rm -rf Pipfile* deps -pipenv lock --clear --three --requirements 1>deps +pipenv lock --clear +pipenv requirements 1>deps grep '==' deps | sed "s/;\\sextra.*//" > requirements.txt rm -rf Pipfile* deps diff --git a/build_scripts/run_tests.sh b/build_scripts/run_tests.sh old mode 100644 new mode 100755 diff --git a/requirements.txt b/requirements.txt index c7db0d42..3565d4fa 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,19 +1,18 @@ simpledi==0.4.1 -awscli==1.27.45 -boto3==1.26.44 +awscli==1.29.12 +boto3==1.28.12 boto==2.49.0 -ansible==2.9.25 -PyYAML==5.4.1 +ansible==8.2.0 azure-common==1.1.28 azure==4.0.0 msrestazure==0.6.4 -Jinja2==2.11.3 +Jinja2==3.1.2 hashmerge python-consul -hvac==0.11.2 +hvac==1.1.1 passgen inflection==0.5.1 kubernetes==26.1.0 -himl==0.13.0 +himl==0.15.0 six GitPython==3.1.* diff --git a/setup.py b/setup.py index b0b158fd..81ea1e0e 100644 --- a/setup.py +++ b/setup.py @@ -39,11 +39,9 @@ 'License :: OSI Approved :: Apache Software License', 'Operating System :: OS Independent', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', diff --git a/src/ops/cli/config.py b/src/ops/cli/config.py index 38e0fb00..b3734a3e 100644 --- a/src/ops/cli/config.py +++ b/src/ops/cli/config.py @@ -119,6 +119,7 @@ def get(self): context_cliargs['extra_vars'] = tuple(extra_vars) context.CLIARGS = ImmutableDict(context_cliargs) + setattr(load_extra_vars, 'extra_vars', {}) variable_manager._extra_vars = load_extra_vars( loader=data_loader) @@ -158,12 +159,15 @@ def get(self): context_cliargs['extra_vars'] = tuple(extra_vars) context.CLIARGS = ImmutableDict(context_cliargs) + setattr(load_extra_vars, 'extra_vars', {}) variable_manager._extra_vars = load_extra_vars( loader=data_loader) read_variables = variable_manager.get_vars() templar = Templar(data_loader, variables=read_variables) - templar._filter_loader = self.template.filter_plugin_loader + + for filter in self.template.filter_plugin_loader.all(): + templar.environment.filters.update(filter.filters()) return templar.template(read_variables, fail_on_undefined=True) diff --git a/tests/e2e/fixture/ansible/ansible.cfg b/tests/e2e/fixture/ansible/ansible.cfg index d41627f3..9f05bbed 100644 --- a/tests/e2e/fixture/ansible/ansible.cfg +++ b/tests/e2e/fixture/ansible/ansible.cfg @@ -1,2 +1,2 @@ [defaults] -library=modules \ No newline at end of file +library=modules diff --git a/tests/e2e/fixture/ansible/clusters/test_filters.yaml b/tests/e2e/fixture/ansible/clusters/test_filters.yaml index 81cca7f9..38af455e 100644 --- a/tests/e2e/fixture/ansible/clusters/test_filters.yaml +++ b/tests/e2e/fixture/ansible/clusters/test_filters.yaml @@ -3,4 +3,4 @@ inventory: test_standard_filters: "{{ [1, 2, 3] | sum }}" test_custom_filters: "{{ 'value' | my_filter }}" -test_ops_filters: "{{ 'escape\ntest' | escape_new_lines }}" \ No newline at end of file +test_ops_filters: "{{ 'escape\ntest' | escape_new_lines }}" diff --git a/tests/e2e/fixture/terraform/terraform/main/main.tf.jinja2 b/tests/e2e/fixture/terraform/terraform/main/main.tf.jinja2 index 24da68db..436b481b 100644 --- a/tests/e2e/fixture/terraform/terraform/main/main.tf.jinja2 +++ b/tests/e2e/fixture/terraform/terraform/main/main.tf.jinja2 @@ -1,3 +1,4 @@ +variable "cluster" {} variable "user_data" { description = "The user-data passed to the instance. Changing this will re-create the instances." @@ -8,4 +9,4 @@ variable "user_data" { output "user_data_out" { value = "${var.user_data}" -} \ No newline at end of file +}