From 82dfea656d3091a47bef6a568370b696d0762850 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 Dec 2021 12:01:33 +0000 Subject: [PATCH 01/35] feat(deps): bump python from 3.10.0-buster to 3.10.1-buster Bumps python from 3.10.0-buster to 3.10.1-buster. --- updated-dependencies: - dependency-name: python dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 0dec2d75..7d1378f5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.10.0-buster +FROM python:3.10.1-buster RUN apt-get update -y RUN apt-get install -y build-essential WORKDIR /code From d92fede1a1631db40ad01e5eaebe3dc8343ed0ff Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Dec 2021 12:12:23 +0000 Subject: [PATCH 02/35] feat(deps): bump peter-evans/create-pull-request from 3.11.0 to 3.12.0 Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 3.11.0 to 3.12.0. - [Release notes](https://github.com/peter-evans/create-pull-request/releases) - [Commits](https://github.com/peter-evans/create-pull-request/compare/v3.11.0...v3.12.0) --- updated-dependencies: - dependency-name: peter-evans/create-pull-request dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/blacked.yml | 2 +- .github/workflows/update_docker_tags.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/blacked.yml b/.github/workflows/blacked.yml index 16cfd11a..f0d83780 100644 --- a/.github/workflows/blacked.yml +++ b/.github/workflows/blacked.yml @@ -17,7 +17,7 @@ jobs: - name: Create Pull Request if: steps.git-check.outputs.modified == 'true' id: cpr - uses: peter-evans/create-pull-request@v3.11.0 + uses: peter-evans/create-pull-request@v3.12.0 with: token: ${{ secrets.GITHUB_TOKEN }} commit-message: fix(Linting):blacked code diff --git a/.github/workflows/update_docker_tags.yml b/.github/workflows/update_docker_tags.yml index c59f4bde..16bbe47a 100644 --- a/.github/workflows/update_docker_tags.yml +++ b/.github/workflows/update_docker_tags.yml @@ -24,7 +24,7 @@ jobs: - name: Create Pull Request if: steps.git-check.outputs.modified == 'true' id: cpr - uses: peter-evans/create-pull-request@v3.11.0 + uses: peter-evans/create-pull-request@v3.12.0 with: token: ${{ secrets.GITHUB_TOKEN }} commit-message: feat(Dockerfile):updated dependencies From fa438cc47cf335c9340623b3bf362ac1cf4dc5d8 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 3 Jan 2022 14:52:09 +0000 Subject: [PATCH 03/35] feat(Dependencies): Pin dependency ruamel.yaml to ==0.17.20 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index b4b6661d..56268423 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,7 @@ deprecated == 1.2.13 Click==8.0.3 ansible==5.0.1 flake8==4.0.1 -ruamel.yaml<0.18.0 +ruamel.yaml==0.17.20 paramiko==2.8.1 pyvim==3.0.2 redis==4.0.2 From cb8172a86e552da3fce3e46f6671b89d07378a28 Mon Sep 17 00:00:00 2001 From: dweinholz Date: Mon, 3 Jan 2022 15:59:22 +0100 Subject: [PATCH 04/35] removed action --- .github/workflows/update_docker_tags.yml | 43 ------------------------ 1 file changed, 43 deletions(-) delete mode 100644 .github/workflows/update_docker_tags.yml diff --git a/.github/workflows/update_docker_tags.yml b/.github/workflows/update_docker_tags.yml deleted file mode 100644 index 16bbe47a..00000000 --- a/.github/workflows/update_docker_tags.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Update env tags -on: - push: - branches: - - dev - paths: - - 'Dockerfile.update' - -jobs: - build-test: - runs-on: ubuntu-latest - steps: - - name: Workflow run cleanup action - uses: rokroskar/workflow-run-cleanup-action@v0.3.3 - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - uses: actions/checkout@v2.4.0 - - run: | - python3 update_env_by_dockerfile.py Dockerfile.update .env.in - echo $? - - name: Check for modified files - id: git-check - run: echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi) - - name: Create Pull Request - if: steps.git-check.outputs.modified == 'true' - id: cpr - uses: peter-evans/create-pull-request@v3.12.0 - with: - token: ${{ secrets.GITHUB_TOKEN }} - commit-message: feat(Dockerfile):updated dependencies - title: Updated .Env. Tags - body: | - - updated env tags - - Auto-generated by [create-pull-request][1] - [1]: https://github.com/peter-evans/create-pull-request - labels: env - reviewers: | - dweinholz - eKatchko - vktrrdk - branch: feat/updated_env - base: dev - From 612e756a012c076fccd022f56da6dcd3fe6692e7 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 3 Jan 2022 15:01:40 +0000 Subject: [PATCH 05/35] feat(Dependencies): Update dependency paramiko to v2.9.1 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index b4b6661d..c2a134a7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,7 +7,7 @@ Click==8.0.3 ansible==5.0.1 flake8==4.0.1 ruamel.yaml<0.18.0 -paramiko==2.8.1 +paramiko==2.9.1 pyvim==3.0.2 redis==4.0.2 requests==2.26.0 From 450ff76721f2181dc438bf5f7b844f13b2440b1f Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 3 Jan 2022 16:03:48 +0000 Subject: [PATCH 06/35] feat(Dependencies): Update dependency redis to v4.1.0 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index a780137a..458fc404 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,6 +9,6 @@ flake8==4.0.1 paramiko==2.9.1 ruamel.yaml==0.17.20 pyvim==3.0.2 -redis==4.0.2 +redis==4.1.0 requests==2.26.0 pyyaml==6.0 From 35d1863c490279498b827834283043f54d37a9d1 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 3 Jan 2022 17:32:04 +0000 Subject: [PATCH 07/35] feat(Dependencies): Update dependency setuptools to v59.8.0 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 458fc404..e99fc50d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -setuptools==59.6.0 +setuptools==59.8.0 thrift==0.15.0 python-keystoneclient openstacksdk ==0.61.0 From de14b838ebab4cc0b12fcf742697bafa3bc4669c Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 3 Jan 2022 17:32:00 +0000 Subject: [PATCH 08/35] feat(Dependencies): Update dependency requests to v2.27.0 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 458fc404..93d089ed 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,5 +10,5 @@ paramiko==2.9.1 ruamel.yaml==0.17.20 pyvim==3.0.2 redis==4.1.0 -requests==2.26.0 +requests==2.27.0 pyyaml==6.0 From fb3237ca18844a4672783b755895521715d2fad9 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 4 Jan 2022 07:23:50 +0000 Subject: [PATCH 09/35] feat(Dependencies): Update dependency ansible to v5.1.0 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 83f4e9bc..3d401ee9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,7 @@ python-keystoneclient openstacksdk ==0.61.0 deprecated == 1.2.13 Click==8.0.3 -ansible==5.0.1 +ansible==5.1.0 flake8==4.0.1 paramiko==2.9.1 ruamel.yaml==0.17.20 From e391ce074d1d5d5805ce8b91ad155f0beb1d1cdd Mon Sep 17 00:00:00 2001 From: dweinholz Date: Tue, 4 Jan 2022 08:24:54 +0100 Subject: [PATCH 10/35] Update docker-compose.bibigrid.yml --- docker-compose.bibigrid.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.bibigrid.yml b/docker-compose.bibigrid.yml index 69471c02..27e56947 100644 --- a/docker-compose.bibigrid.yml +++ b/docker-compose.bibigrid.yml @@ -38,7 +38,7 @@ services: # filebeat filebeat: - image: docker.elastic.co/beats/filebeat:filebeat:7.16.1 + image: docker.elastic.co/beats/filebeat:7.16.1 env_file: - .env volumes: From 37e35f2e6556163ac62c13a2170150f0baa77881 Mon Sep 17 00:00:00 2001 From: dweinholz Date: Tue, 4 Jan 2022 08:54:52 +0100 Subject: [PATCH 11/35] Update autoupdate.yml --- .github/workflows/autoupdate.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/autoupdate.yml b/.github/workflows/autoupdate.yml index 42ebb7fe..f738b0c7 100644 --- a/.github/workflows/autoupdate.yml +++ b/.github/workflows/autoupdate.yml @@ -13,3 +13,5 @@ jobs: GITHUB_TOKEN: "${{ secrets.GITHUBSECRET2 }}" MERGE_MSG: "Branch was auto-updated." MERGE_CONFLICT_ACTION: "ignore" + EXCLUDE_LABELS: "dependencies" + From 914d128cc0d4c5660046a57f18064e0c64d0d51d Mon Sep 17 00:00:00 2001 From: dweinholz Date: Tue, 4 Jan 2022 08:56:57 +0100 Subject: [PATCH 12/35] Delete update_env_by_dockerfile.py --- update_env_by_dockerfile.py | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 update_env_by_dockerfile.py diff --git a/update_env_by_dockerfile.py b/update_env_by_dockerfile.py deleted file mode 100644 index 96316dd8..00000000 --- a/update_env_by_dockerfile.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/python -import fileinput -import sys - -DOCKERFILE = sys.argv[1] -ENV_FILE = sys.argv[2] - -update_env = {} -with open(DOCKERFILE) as f: - for line in f: - vars = line.replace("FROM", "").strip().split(":") - image = vars[0].split("/")[-1].replace("-", "_") - tag = vars[-1] - value_to_add = "{}_TAG={}\n".format(image.upper(), tag) - key = "{}_TAG".format(image.upper()) - print("Added tag {}".format(value_to_add)) - update_env.update({key: value_to_add}) - -for line in fileinput.input([ENV_FILE], inplace=True): - if "=" in line: - key = line.split("=")[0] - if key in update_env: - sys.stdout.write(update_env[key]) - else: - sys.stdout.write(line) - else: - sys.stdout.write(line) From 5340b90bd38a6eec7ed3a3cd89532876be3d3361 Mon Sep 17 00:00:00 2001 From: dweinholz Date: Tue, 4 Jan 2022 08:58:03 +0100 Subject: [PATCH 13/35] Update .env.in --- .env.in | 3 --- 1 file changed, 3 deletions(-) diff --git a/.env.in b/.env.in index 58ee45c4..781b0e98 100644 --- a/.env.in +++ b/.env.in @@ -1,6 +1,4 @@ # Client and Bibigrid -CLOUD_PORTAL_CLIENT_TAG=0.1.0-beta.0.15.1 -BIBIGRID_TAG=bibigrid-rest-2.3 FORC_API_KEY= @@ -14,7 +12,6 @@ OS_PROJECT_DOMAIN_ID= OS_PASSWORD= # Filebeat -FILEBEAT_TAG=7.15.2 ELASTIC_USER= ELASTIC_PASSWORD= HOST=portal-dev.denbi.de From b961e746291de3e6997314e3020eb7d7d8dee966 Mon Sep 17 00:00:00 2001 From: dweinholz Date: Tue, 4 Jan 2022 09:01:35 +0100 Subject: [PATCH 14/35] Delete dependabot.yml --- .github/dependabot.yml | 51 ------------------------------------------ 1 file changed, 51 deletions(-) delete mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 5e00009a..00000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,51 +0,0 @@ -version: 2 -updates: - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "weekly" - target-branch: "dev" - reviewers: - - "deNBI/portal-dev" - commit-message: - prefix: "feat" - include: "scope" - open-pull-requests-limit: 15 - - - package-ecosystem: "pip" - directory: "/" - schedule: - interval: "weekly" - target-branch: "dev" - reviewers: - - "deNBI/portal-dev" - commit-message: - prefix: "feat" - include: "scope" - open-pull-requests-limit: 15 - - - package-ecosystem: "docker" - directory: "/" - schedule: - interval: "weekly" - target-branch: "dev" - reviewers: - - "deNBI/portal-dev" - commit-message: - prefix: "feat" - include: "scope" - open-pull-requests-limit: 15 - - - package-ecosystem: "docker" - directory: "/Dockerfile.update" - schedule: - interval: "weekly" - target-branch: "dev" - reviewers: - - "deNBI/portal-dev" - commit-message: - prefix: "feat" - include: "scope" - open-pull-requests-limit: 15 - - From f2736e9a227ac824c7ba03ac5a974b8f5c2ffbb9 Mon Sep 17 00:00:00 2001 From: dweinholz Date: Tue, 4 Jan 2022 09:03:35 +0100 Subject: [PATCH 15/35] Delete Dockerfile.update --- Dockerfile.update | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 Dockerfile.update diff --git a/Dockerfile.update b/Dockerfile.update deleted file mode 100644 index dc8cd21e..00000000 --- a/Dockerfile.update +++ /dev/null @@ -1,3 +0,0 @@ -FROM denbicloud/cloud-portal-client:0.1.0-beta.0.15.1 -FROM bibiserv/bibigrid:bibigrid-rest-2.3 -FROM docker.elastic.co/beats/filebeat:7.16.1 From b4ad7ee0124b226dc50a0ef59acc7dccaf9e7b74 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 4 Jan 2022 09:29:08 +0000 Subject: [PATCH 16/35] feat(Dependencies): Update docker.elastic.co/beats/filebeat Docker tag to v7.16.2 --- docker-compose.bibigrid.yml | 2 +- docker-compose.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.bibigrid.yml b/docker-compose.bibigrid.yml index 27e56947..81ab3163 100644 --- a/docker-compose.bibigrid.yml +++ b/docker-compose.bibigrid.yml @@ -38,7 +38,7 @@ services: # filebeat filebeat: - image: docker.elastic.co/beats/filebeat:7.16.1 + image: docker.elastic.co/beats/filebeat:7.16.2 env_file: - .env volumes: diff --git a/docker-compose.yml b/docker-compose.yml index a13997b7..e952e154 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,7 +26,7 @@ services: # filebeat filebeat: container_name: client_filebeat - image: docker.elastic.co/beats/filebeat:7.16.1 + image: docker.elastic.co/beats/filebeat:7.16.2 env_file: - .env volumes: From e240842af798bcece0c27d11fd7e50730c3cca76 Mon Sep 17 00:00:00 2001 From: dweinholz Date: Wed, 5 Jan 2022 11:40:46 +0100 Subject: [PATCH 17/35] Update autoupdate.yml --- .github/workflows/autoupdate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/autoupdate.yml b/.github/workflows/autoupdate.yml index 6a5a4e9e..4f8c35cb 100644 --- a/.github/workflows/autoupdate.yml +++ b/.github/workflows/autoupdate.yml @@ -13,4 +13,4 @@ jobs: GITHUB_TOKEN: "${{ secrets.GITHUBSECRET2 }}" MERGE_MSG: "Branch was auto-updated." MERGE_CONFLICT_ACTION: "ignore" - EXCLUDE_LABELS: "dependencies" + EXCLUDED_LABELS: "dependencies" From f28a2546e07a2b1da9ca821012e750c832dd07f4 Mon Sep 17 00:00:00 2001 From: dweinholz Date: Wed, 5 Jan 2022 14:51:29 +0100 Subject: [PATCH 18/35] Update docker-compose.yml --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index e952e154..6fbd8ac5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: '3.5' services: portal-client: container_name: client - image: denbicloud/cloud-portal-client:0.1.0-beta.0.15.1 + image: denbicloud/cloud-portal-client:${CLOUD_PORTAL_CLIENT_TAG} ports: - ${CLIENT_PORT}:9090 env_file: From 317c09674b0f455e626ad8a133e476859b32c301 Mon Sep 17 00:00:00 2001 From: dweinholz Date: Wed, 5 Jan 2022 14:51:53 +0100 Subject: [PATCH 19/35] Update docker-compose.bibigrid.yml --- docker-compose.bibigrid.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.bibigrid.yml b/docker-compose.bibigrid.yml index f70c77be..e588596b 100644 --- a/docker-compose.bibigrid.yml +++ b/docker-compose.bibigrid.yml @@ -2,7 +2,7 @@ version: '3.5' services: portal-client: container_name: client - image: denbicloud/cloud-portal-client:0.1.0-beta.0.20.4 + image: denbicloud/cloud-portal-client:${CLOUD_PORTAL_CLIENT_TAG} ports: - ${CLIENT_PORT}:9090 env_file: From fe66180834adc7be73e285ddc7a078baad0eea65 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 5 Jan 2022 14:59:19 +0000 Subject: [PATCH 20/35] feat(Dependencies): Update dependency setuptools to v60 | datasource | package | from | to | | ---------- | ---------- | ------ | ------ | | pypi | setuptools | 59.8.0 | 60.2.0 | --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 3d401ee9..519fef1b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -setuptools==59.8.0 +setuptools==60.2.0 thrift==0.15.0 python-keystoneclient openstacksdk ==0.61.0 From 679c2ad6befcca5cfb323cc54c1948d8212a42b3 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 5 Jan 2022 16:27:31 +0000 Subject: [PATCH 21/35] feat(Dependencies): Update dependency requests to v2.27.1 | datasource | package | from | to | | ---------- | -------- | ------ | ------ | | pypi | requests | 2.27.0 | 2.27.1 | --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 519fef1b..6c346313 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,5 +10,5 @@ paramiko==2.9.1 ruamel.yaml==0.17.20 pyvim==3.0.2 redis==4.1.0 -requests==2.27.0 +requests==2.27.1 pyyaml==6.0 From 8d9498abdb8cb1bb39c359b1939c15ab5e51adab Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 6 Jan 2022 19:04:43 +0000 Subject: [PATCH 22/35] feat(Dependencies): Update dependency setuptools to v60.3.1 | datasource | package | from | to | | ---------- | ---------- | ------ | ------ | | pypi | setuptools | 60.2.0 | 60.3.1 | --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 6c346313..1df009c9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -setuptools==60.2.0 +setuptools==60.3.1 thrift==0.15.0 python-keystoneclient openstacksdk ==0.61.0 From 8f81ea92dbc8b118055cbb14373dc5fe7bd85e1e Mon Sep 17 00:00:00 2001 From: dweinholz Date: Fri, 7 Jan 2022 10:56:59 +0100 Subject: [PATCH 23/35] fix(Cluster):if old image is deactive find active with same distro and version --- .../VirtualMachineHandler.py | 222 ++++++++++-------- 1 file changed, 123 insertions(+), 99 deletions(-) diff --git a/VirtualMachineService/VirtualMachineHandler.py b/VirtualMachineService/VirtualMachineHandler.py index f22c4266..93c3b976 100644 --- a/VirtualMachineService/VirtualMachineHandler.py +++ b/VirtualMachineService/VirtualMachineHandler.py @@ -225,9 +225,9 @@ def __init__(self, config): self.FORC_REMOTE_ID = cfg["forc"]["forc_remote_id"] self.GITHUB_PLAYBOOKS_REPO = cfg["forc"]["github_playbooks_repo"] if ( - not self.RE_BACKEND_URL - or not self.FORC_API_KEY - or not self.GITHUB_PLAYBOOKS_REPO + not self.RE_BACKEND_URL + or not self.FORC_API_KEY + or not self.GITHUB_PLAYBOOKS_REPO ): raise ValueError LOG.info(msg="Forc-Backend url loaded: {0}".format(self.RE_BACKEND_URL)) @@ -370,10 +370,10 @@ def get_Images(self): images = list() try: for img in filter( - lambda x: "tags" in x - and len(x["tags"]) > 0 - and x["status"] == "active", - self.conn.list_images(), + lambda x: "tags" in x + and len(x["tags"]) > 0 + and x["status"] == "active", + self.conn.list_images(), ): metadata = img["metadata"] @@ -381,7 +381,7 @@ def get_Images(self): tags = img.get("tags") LOG.info(set(self.ALL_TEMPLATES).intersection(tags)) if len( - set(self.ALL_TEMPLATES).intersection(tags) + set(self.ALL_TEMPLATES).intersection(tags) ) > 0 and not self.cross_check_forc_image(tags): LOG.info("Resenv check: Skipping {0}.".format(img["name"])) continue @@ -417,7 +417,7 @@ def prepare_image(self, img): tags = img.get("tags") LOG.info(set(self.ALL_TEMPLATES).intersection(tags)) if len( - set(self.ALL_TEMPLATES).intersection(tags) + set(self.ALL_TEMPLATES).intersection(tags) ) > 0 and not self.cross_check_forc_image(tags): LOG.info("Resenv check: Skipping {0}.".format(img["name"])) return None @@ -453,11 +453,11 @@ def get_public_Images(self): images = list() try: for img in filter( - lambda x: "tags" in x - and len(x["tags"]) > 0 - and x["status"] == "active" - and x["visibility"] == "public", - self.conn.list_images(), + lambda x: "tags" in x + and len(x["tags"]) > 0 + and x["status"] == "active" + and x["visibility"] == "public", + self.conn.list_images(), ): image = self.prepare_image(img) if image is None: @@ -479,11 +479,11 @@ def get_private_Images(self): images = list() try: for img in filter( - lambda x: "tags" in x - and len(x["tags"]) > 0 - and x["status"] == "active" - and x["visibility"] == "private", - self.conn.list_images(), + lambda x: "tags" in x + and len(x["tags"]) > 0 + and x["status"] == "active" + and x["visibility"] == "private", + self.conn.list_images(), ): image = self.prepare_image(img) if image is None: @@ -536,10 +536,10 @@ def get_Images_by_filter(self, filter_list): images = list() try: for img in filter( - lambda x: "tags" in x - and len(x["tags"]) > 0 - and x["status"] == "active", - self.conn.list_images(), + lambda x: "tags" in x + and len(x["tags"]) > 0 + and x["status"] == "active", + self.conn.list_images(), ): tags = img.get("tags") if "resenv" in filter_list: @@ -791,7 +791,7 @@ def create_add_keys_script(self, keys): return key_script def create_mount_init_script( - self, volume_ids_path_new=None, volume_ids_path_attach=None + self, volume_ids_path_new=None, volume_ids_path_attach=None ): LOG.info("create init script for volume ids:{}".format(volume_ids_path_new)) if not volume_ids_path_new and not volume_ids_path_attach: @@ -940,17 +940,17 @@ def create_volume(self, volume_name, volume_storage, metadata): raise ressourceException(Reason=str(e)) def volume_ids( - self, - flavor, - image, - public_key, - servername, - metadata, - https, - http, - resenv, - volume_ids_path_new, - volume_ids_path_attach, + self, + flavor, + image, + public_key, + servername, + metadata, + https, + http, + resenv, + volume_ids_path_new, + volume_ids_path_attach, ): image = self.get_image(image=image) flavor = self.get_flavor(flavor=flavor) @@ -1023,18 +1023,18 @@ def prepare_security_groups_new_server(self, resenv, servername, http, https): return custom_security_groups def start_server_without_playbook( - self, - flavor, - image, - public_key, - servername, - metadata, - https, - http, - resenv, - volume_ids_path_new=None, - volume_ids_path_attach=None, - additional_keys=None, + self, + flavor, + image, + public_key, + servername, + metadata, + https, + http, + resenv, + volume_ids_path_new=None, + volume_ids_path_attach=None, + additional_keys=None, ): """ Start a new Server. @@ -1083,9 +1083,9 @@ def start_server_without_playbook( if init_script: add_key_script = self.create_add_keys_script(keys=additional_keys) init_script = ( - add_key_script - + encodeutils.safe_encode("\n".encode("utf-8")) - + init_script + add_key_script + + encodeutils.safe_encode("\n".encode("utf-8")) + + init_script ) else: @@ -1118,17 +1118,17 @@ def start_server_without_playbook( return {} def start_server( - self, - flavor, - image, - public_key, - servername, - metadata, - diskspace, - volumename, - https, - http, - resenv, + self, + flavor, + image, + public_key, + servername, + metadata, + diskspace, + volumename, + https, + http, + resenv, ): """ Start a new Server. @@ -1182,16 +1182,16 @@ def start_server( return {} def start_server_with_custom_key( - self, - flavor, - image, - servername, - metadata, - http, - https, - resenv, - volume_ids_path_new=None, - volume_ids_path_attach=None, + self, + flavor, + image, + servername, + metadata, + http, + https, + resenv, + volume_ids_path_new=None, + volume_ids_path_attach=None, ): """ @@ -1267,7 +1267,7 @@ def start_server_with_custom_key( return {} def create_and_deploy_playbook( - self, public_key, playbooks_information, openstack_id + self, public_key, playbooks_information, openstack_id ): global active_playbooks LOG.info(msg="Starting Playbook for (openstack_id): {0}".format(openstack_id)) @@ -1316,8 +1316,8 @@ def cross_check_forc_image(self, tags): cross_tags = list(set(self.ALL_TEMPLATES).intersection(tags)) for template_dict in templates: if ( - template_dict["name"] in self.FORC_ALLOWED - and template_dict["name"] in cross_tags + template_dict["name"] in self.FORC_ALLOWED + and template_dict["name"] in cross_tags ): if template_dict["version"] in self.FORC_ALLOWED[template_dict["name"]]: return True @@ -1950,8 +1950,8 @@ def add_udp_security_group(self, server_id): ip_base = ( list(self.conn.compute.server_ips(server=server_id))[0] - .to_dict()["address"] - .split(".")[-1] + .to_dict()["address"] + .split(".")[-1] ) x = int(ip_base) udp_port_start = eval(self.UDP_PORT_CALCULATION) @@ -2073,11 +2073,35 @@ def get_clusters_info(self): infos = response.json()["info"] return infos + def get_active_image_by_os_version(self, os_version, os_distro): + LOG.info(f"Get active Image by os-version: {os_version}") + images = self.conn.list_images() + for image in images: + metadata = image["metadata"] + image_os_version = metadata.get("os_version", None) + image_os_distro = metadata.get("os_distro", None) + if os_version == image_os_version and image.status == "active": + if os_distro and os_distro == image_os_distro: + return image + elif os_distro is None: + return image + return None + def scale_up_cluster( - self, cluster_id, image, flavor, count, names, start_idx, batch_index + self, cluster_id, image, flavor, count, names, start_idx, batch_index ): cluster_info = self.get_cluster_info(cluster_id=cluster_id) image = self.get_image(image=image) + if image.status != "active": + metadata = image["metadata"] + image_os_version = metadata.get("os_version", None) + image_os_distro = metadata.get("os_distro", None) + image = self.get_active_image_by_os_version(os_version=image_os_version, os_distro=image_os_distro) + if not image: + raise imageNotFoundException( + Reason=(f"No active Image with os_version {image_os_version} found!") + ) + flavor = self.get_flavor(flavor=flavor) network = self.get_network() openstack_ids = [] @@ -2351,9 +2375,9 @@ def delete_server(self, openstack_id): return False task_state = self.check_server_task_state(openstack_id) if ( - task_state == "image_snapshot" - or task_state == "image_pending_upload" - or task_state == "image_uploading" + task_state == "image_snapshot" + or task_state == "image_pending_upload" + or task_state == "image_uploading" ): raise ConflictException("task_state in image creating") security_groups = self.conn.list_server_security_groups(server=server) @@ -2362,7 +2386,7 @@ def delete_server(self, openstack_id): sec for sec in security_groups if sec.name != self.DEFAULT_SECURITY_GROUP_NAME - and not "bibigrid" in sec.name + and not "bibigrid" in sec.name ] if security_groups is not None: for sg in security_groups: @@ -2515,15 +2539,15 @@ def resume_server(self, openstack_id): return False def create_security_group( - self, - name, - udp_port_start=None, - ssh=True, - http=False, - https=False, - udp=False, - description=None, - resenv=[], + self, + name, + udp_port_start=None, + ssh=True, + http=False, + https=False, + udp=False, + description=None, + resenv=[], ): LOG.info("Create new security group {}".format(name)) sec = self.conn.get_security_group(name_or_id=name) @@ -2757,15 +2781,15 @@ def update_forc_allowed(self, template_metadata): class ResenvMetadata: def __init__( - self, - name, - port, - security_group_name, - security_group_description, - security_group_ssh, - direction, - protocol, - information_for_display, + self, + name, + port, + security_group_name, + security_group_description, + security_group_ssh, + direction, + protocol, + information_for_display, ): self.name = name self.port = port From 8afaca1510e2cfc5814e23a3907f212e1476db8d Mon Sep 17 00:00:00 2001 From: dweinholz Date: Fri, 7 Jan 2022 13:32:13 +0100 Subject: [PATCH 24/35] fixed scaling --- .../VirtualMachineHandler.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/VirtualMachineService/VirtualMachineHandler.py b/VirtualMachineService/VirtualMachineHandler.py index 93c3b976..76e754b3 100644 --- a/VirtualMachineService/VirtualMachineHandler.py +++ b/VirtualMachineService/VirtualMachineHandler.py @@ -752,7 +752,8 @@ def check_server_task_state(self, openstack_id): return "No active task" def get_image(self, image): - image = self.conn.compute.find_image(image) + image = self.conn.get_image(name_or_id=image) + if image is None: LOG.exception("Image {0} not found!".format(image)) raise imageNotFoundException(Reason=("Image {0} not found".format(image))) @@ -2076,24 +2077,30 @@ def get_clusters_info(self): def get_active_image_by_os_version(self, os_version, os_distro): LOG.info(f"Get active Image by os-version: {os_version}") images = self.conn.list_images() + active_image = None for image in images: metadata = image["metadata"] image_os_version = metadata.get("os_version", None) image_os_distro = metadata.get("os_distro", None) if os_version == image_os_version and image.status == "active": if os_distro and os_distro == image_os_distro: - return image + active_image = image elif os_distro is None: - return image - return None + active_image = image + return active_image def scale_up_cluster( self, cluster_id, image, flavor, count, names, start_idx, batch_index ): cluster_info = self.get_cluster_info(cluster_id=cluster_id) image = self.get_image(image=image) - if image.status != "active": - metadata = image["metadata"] + if not image: + raise imageNotFoundException( + Reason=(f"No Image {image} found!") + ) + if image and image.status != "active": + LOG.info(image.keys()) + metadata = image.get("metadata", None) image_os_version = metadata.get("os_version", None) image_os_distro = metadata.get("os_distro", None) image = self.get_active_image_by_os_version(os_version=image_os_version, os_distro=image_os_distro) From 763620c9affea2371df2fcdf49d79ca29ffdef03 Mon Sep 17 00:00:00 2001 From: dweinholz Date: Fri, 7 Jan 2022 13:33:35 +0100 Subject: [PATCH 25/35] fixed image scaling --- VirtualMachineService/VirtualMachineHandler.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/VirtualMachineService/VirtualMachineHandler.py b/VirtualMachineService/VirtualMachineHandler.py index 76e754b3..a3efde29 100644 --- a/VirtualMachineService/VirtualMachineHandler.py +++ b/VirtualMachineService/VirtualMachineHandler.py @@ -2077,17 +2077,16 @@ def get_clusters_info(self): def get_active_image_by_os_version(self, os_version, os_distro): LOG.info(f"Get active Image by os-version: {os_version}") images = self.conn.list_images() - active_image = None for image in images: metadata = image["metadata"] image_os_version = metadata.get("os_version", None) image_os_distro = metadata.get("os_distro", None) if os_version == image_os_version and image.status == "active": if os_distro and os_distro == image_os_distro: - active_image = image + return image elif os_distro is None: - active_image = image - return active_image + return image + return None def scale_up_cluster( self, cluster_id, image, flavor, count, names, start_idx, batch_index From 806ade7c89ffff2d77f512fc0bf2219d57c23579 Mon Sep 17 00:00:00 2001 From: dweinholz Date: Fri, 7 Jan 2022 13:34:04 +0100 Subject: [PATCH 26/35] fixed image scaling --- VirtualMachineService/VirtualMachineHandler.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/VirtualMachineService/VirtualMachineHandler.py b/VirtualMachineService/VirtualMachineHandler.py index 76e754b3..a3efde29 100644 --- a/VirtualMachineService/VirtualMachineHandler.py +++ b/VirtualMachineService/VirtualMachineHandler.py @@ -2077,17 +2077,16 @@ def get_clusters_info(self): def get_active_image_by_os_version(self, os_version, os_distro): LOG.info(f"Get active Image by os-version: {os_version}") images = self.conn.list_images() - active_image = None for image in images: metadata = image["metadata"] image_os_version = metadata.get("os_version", None) image_os_distro = metadata.get("os_distro", None) if os_version == image_os_version and image.status == "active": if os_distro and os_distro == image_os_distro: - active_image = image + return image elif os_distro is None: - active_image = image - return active_image + return image + return None def scale_up_cluster( self, cluster_id, image, flavor, count, names, start_idx, batch_index From c627618f049d01ad9745ba728e2de131b7b1e758 Mon Sep 17 00:00:00 2001 From: dweinholz Date: Fri, 7 Jan 2022 12:34:37 +0000 Subject: [PATCH 27/35] fix(Linting):blacked code --- .../VirtualMachineHandler.py | 210 +++++++++--------- 1 file changed, 106 insertions(+), 104 deletions(-) diff --git a/VirtualMachineService/VirtualMachineHandler.py b/VirtualMachineService/VirtualMachineHandler.py index a3efde29..b4106469 100644 --- a/VirtualMachineService/VirtualMachineHandler.py +++ b/VirtualMachineService/VirtualMachineHandler.py @@ -225,9 +225,9 @@ def __init__(self, config): self.FORC_REMOTE_ID = cfg["forc"]["forc_remote_id"] self.GITHUB_PLAYBOOKS_REPO = cfg["forc"]["github_playbooks_repo"] if ( - not self.RE_BACKEND_URL - or not self.FORC_API_KEY - or not self.GITHUB_PLAYBOOKS_REPO + not self.RE_BACKEND_URL + or not self.FORC_API_KEY + or not self.GITHUB_PLAYBOOKS_REPO ): raise ValueError LOG.info(msg="Forc-Backend url loaded: {0}".format(self.RE_BACKEND_URL)) @@ -370,10 +370,10 @@ def get_Images(self): images = list() try: for img in filter( - lambda x: "tags" in x - and len(x["tags"]) > 0 - and x["status"] == "active", - self.conn.list_images(), + lambda x: "tags" in x + and len(x["tags"]) > 0 + and x["status"] == "active", + self.conn.list_images(), ): metadata = img["metadata"] @@ -381,7 +381,7 @@ def get_Images(self): tags = img.get("tags") LOG.info(set(self.ALL_TEMPLATES).intersection(tags)) if len( - set(self.ALL_TEMPLATES).intersection(tags) + set(self.ALL_TEMPLATES).intersection(tags) ) > 0 and not self.cross_check_forc_image(tags): LOG.info("Resenv check: Skipping {0}.".format(img["name"])) continue @@ -417,7 +417,7 @@ def prepare_image(self, img): tags = img.get("tags") LOG.info(set(self.ALL_TEMPLATES).intersection(tags)) if len( - set(self.ALL_TEMPLATES).intersection(tags) + set(self.ALL_TEMPLATES).intersection(tags) ) > 0 and not self.cross_check_forc_image(tags): LOG.info("Resenv check: Skipping {0}.".format(img["name"])) return None @@ -453,11 +453,11 @@ def get_public_Images(self): images = list() try: for img in filter( - lambda x: "tags" in x - and len(x["tags"]) > 0 - and x["status"] == "active" - and x["visibility"] == "public", - self.conn.list_images(), + lambda x: "tags" in x + and len(x["tags"]) > 0 + and x["status"] == "active" + and x["visibility"] == "public", + self.conn.list_images(), ): image = self.prepare_image(img) if image is None: @@ -479,11 +479,11 @@ def get_private_Images(self): images = list() try: for img in filter( - lambda x: "tags" in x - and len(x["tags"]) > 0 - and x["status"] == "active" - and x["visibility"] == "private", - self.conn.list_images(), + lambda x: "tags" in x + and len(x["tags"]) > 0 + and x["status"] == "active" + and x["visibility"] == "private", + self.conn.list_images(), ): image = self.prepare_image(img) if image is None: @@ -536,10 +536,10 @@ def get_Images_by_filter(self, filter_list): images = list() try: for img in filter( - lambda x: "tags" in x - and len(x["tags"]) > 0 - and x["status"] == "active", - self.conn.list_images(), + lambda x: "tags" in x + and len(x["tags"]) > 0 + and x["status"] == "active", + self.conn.list_images(), ): tags = img.get("tags") if "resenv" in filter_list: @@ -792,7 +792,7 @@ def create_add_keys_script(self, keys): return key_script def create_mount_init_script( - self, volume_ids_path_new=None, volume_ids_path_attach=None + self, volume_ids_path_new=None, volume_ids_path_attach=None ): LOG.info("create init script for volume ids:{}".format(volume_ids_path_new)) if not volume_ids_path_new and not volume_ids_path_attach: @@ -941,17 +941,17 @@ def create_volume(self, volume_name, volume_storage, metadata): raise ressourceException(Reason=str(e)) def volume_ids( - self, - flavor, - image, - public_key, - servername, - metadata, - https, - http, - resenv, - volume_ids_path_new, - volume_ids_path_attach, + self, + flavor, + image, + public_key, + servername, + metadata, + https, + http, + resenv, + volume_ids_path_new, + volume_ids_path_attach, ): image = self.get_image(image=image) flavor = self.get_flavor(flavor=flavor) @@ -1024,18 +1024,18 @@ def prepare_security_groups_new_server(self, resenv, servername, http, https): return custom_security_groups def start_server_without_playbook( - self, - flavor, - image, - public_key, - servername, - metadata, - https, - http, - resenv, - volume_ids_path_new=None, - volume_ids_path_attach=None, - additional_keys=None, + self, + flavor, + image, + public_key, + servername, + metadata, + https, + http, + resenv, + volume_ids_path_new=None, + volume_ids_path_attach=None, + additional_keys=None, ): """ Start a new Server. @@ -1084,9 +1084,9 @@ def start_server_without_playbook( if init_script: add_key_script = self.create_add_keys_script(keys=additional_keys) init_script = ( - add_key_script - + encodeutils.safe_encode("\n".encode("utf-8")) - + init_script + add_key_script + + encodeutils.safe_encode("\n".encode("utf-8")) + + init_script ) else: @@ -1119,17 +1119,17 @@ def start_server_without_playbook( return {} def start_server( - self, - flavor, - image, - public_key, - servername, - metadata, - diskspace, - volumename, - https, - http, - resenv, + self, + flavor, + image, + public_key, + servername, + metadata, + diskspace, + volumename, + https, + http, + resenv, ): """ Start a new Server. @@ -1183,16 +1183,16 @@ def start_server( return {} def start_server_with_custom_key( - self, - flavor, - image, - servername, - metadata, - http, - https, - resenv, - volume_ids_path_new=None, - volume_ids_path_attach=None, + self, + flavor, + image, + servername, + metadata, + http, + https, + resenv, + volume_ids_path_new=None, + volume_ids_path_attach=None, ): """ @@ -1268,7 +1268,7 @@ def start_server_with_custom_key( return {} def create_and_deploy_playbook( - self, public_key, playbooks_information, openstack_id + self, public_key, playbooks_information, openstack_id ): global active_playbooks LOG.info(msg="Starting Playbook for (openstack_id): {0}".format(openstack_id)) @@ -1317,8 +1317,8 @@ def cross_check_forc_image(self, tags): cross_tags = list(set(self.ALL_TEMPLATES).intersection(tags)) for template_dict in templates: if ( - template_dict["name"] in self.FORC_ALLOWED - and template_dict["name"] in cross_tags + template_dict["name"] in self.FORC_ALLOWED + and template_dict["name"] in cross_tags ): if template_dict["version"] in self.FORC_ALLOWED[template_dict["name"]]: return True @@ -1951,8 +1951,8 @@ def add_udp_security_group(self, server_id): ip_base = ( list(self.conn.compute.server_ips(server=server_id))[0] - .to_dict()["address"] - .split(".")[-1] + .to_dict()["address"] + .split(".")[-1] ) x = int(ip_base) udp_port_start = eval(self.UDP_PORT_CALCULATION) @@ -2089,23 +2089,25 @@ def get_active_image_by_os_version(self, os_version, os_distro): return None def scale_up_cluster( - self, cluster_id, image, flavor, count, names, start_idx, batch_index + self, cluster_id, image, flavor, count, names, start_idx, batch_index ): cluster_info = self.get_cluster_info(cluster_id=cluster_id) image = self.get_image(image=image) if not image: - raise imageNotFoundException( - Reason=(f"No Image {image} found!") - ) + raise imageNotFoundException(Reason=(f"No Image {image} found!")) if image and image.status != "active": LOG.info(image.keys()) metadata = image.get("metadata", None) image_os_version = metadata.get("os_version", None) image_os_distro = metadata.get("os_distro", None) - image = self.get_active_image_by_os_version(os_version=image_os_version, os_distro=image_os_distro) + image = self.get_active_image_by_os_version( + os_version=image_os_version, os_distro=image_os_distro + ) if not image: raise imageNotFoundException( - Reason=(f"No active Image with os_version {image_os_version} found!") + Reason=( + f"No active Image with os_version {image_os_version} found!" + ) ) flavor = self.get_flavor(flavor=flavor) @@ -2381,9 +2383,9 @@ def delete_server(self, openstack_id): return False task_state = self.check_server_task_state(openstack_id) if ( - task_state == "image_snapshot" - or task_state == "image_pending_upload" - or task_state == "image_uploading" + task_state == "image_snapshot" + or task_state == "image_pending_upload" + or task_state == "image_uploading" ): raise ConflictException("task_state in image creating") security_groups = self.conn.list_server_security_groups(server=server) @@ -2392,7 +2394,7 @@ def delete_server(self, openstack_id): sec for sec in security_groups if sec.name != self.DEFAULT_SECURITY_GROUP_NAME - and not "bibigrid" in sec.name + and not "bibigrid" in sec.name ] if security_groups is not None: for sg in security_groups: @@ -2545,15 +2547,15 @@ def resume_server(self, openstack_id): return False def create_security_group( - self, - name, - udp_port_start=None, - ssh=True, - http=False, - https=False, - udp=False, - description=None, - resenv=[], + self, + name, + udp_port_start=None, + ssh=True, + http=False, + https=False, + udp=False, + description=None, + resenv=[], ): LOG.info("Create new security group {}".format(name)) sec = self.conn.get_security_group(name_or_id=name) @@ -2787,15 +2789,15 @@ def update_forc_allowed(self, template_metadata): class ResenvMetadata: def __init__( - self, - name, - port, - security_group_name, - security_group_description, - security_group_ssh, - direction, - protocol, - information_for_display, + self, + name, + port, + security_group_name, + security_group_description, + security_group_ssh, + direction, + protocol, + information_for_display, ): self.name = name self.port = port From 3b94265d65f52c62ad999493a62f51e64313c2f0 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sat, 8 Jan 2022 19:50:14 +0000 Subject: [PATCH 28/35] feat(Dependencies): Update dependency paramiko to v2.9.2 | datasource | package | from | to | | ---------- | -------- | ----- | ----- | | pypi | paramiko | 2.9.1 | 2.9.2 | --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 1df009c9..ae8510cc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,7 @@ deprecated == 1.2.13 Click==8.0.3 ansible==5.1.0 flake8==4.0.1 -paramiko==2.9.1 +paramiko==2.9.2 ruamel.yaml==0.17.20 pyvim==3.0.2 redis==4.1.0 From d91b92acc3b99771d2c0d1f224fc2c2c08b16b46 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" Date: Sat, 8 Jan 2022 19:51:31 +0000 Subject: [PATCH 29/35] fix(Linting):blacked code --- .../VirtualMachineHandler.py | 210 +++++++++--------- 1 file changed, 106 insertions(+), 104 deletions(-) diff --git a/VirtualMachineService/VirtualMachineHandler.py b/VirtualMachineService/VirtualMachineHandler.py index a3efde29..b4106469 100644 --- a/VirtualMachineService/VirtualMachineHandler.py +++ b/VirtualMachineService/VirtualMachineHandler.py @@ -225,9 +225,9 @@ def __init__(self, config): self.FORC_REMOTE_ID = cfg["forc"]["forc_remote_id"] self.GITHUB_PLAYBOOKS_REPO = cfg["forc"]["github_playbooks_repo"] if ( - not self.RE_BACKEND_URL - or not self.FORC_API_KEY - or not self.GITHUB_PLAYBOOKS_REPO + not self.RE_BACKEND_URL + or not self.FORC_API_KEY + or not self.GITHUB_PLAYBOOKS_REPO ): raise ValueError LOG.info(msg="Forc-Backend url loaded: {0}".format(self.RE_BACKEND_URL)) @@ -370,10 +370,10 @@ def get_Images(self): images = list() try: for img in filter( - lambda x: "tags" in x - and len(x["tags"]) > 0 - and x["status"] == "active", - self.conn.list_images(), + lambda x: "tags" in x + and len(x["tags"]) > 0 + and x["status"] == "active", + self.conn.list_images(), ): metadata = img["metadata"] @@ -381,7 +381,7 @@ def get_Images(self): tags = img.get("tags") LOG.info(set(self.ALL_TEMPLATES).intersection(tags)) if len( - set(self.ALL_TEMPLATES).intersection(tags) + set(self.ALL_TEMPLATES).intersection(tags) ) > 0 and not self.cross_check_forc_image(tags): LOG.info("Resenv check: Skipping {0}.".format(img["name"])) continue @@ -417,7 +417,7 @@ def prepare_image(self, img): tags = img.get("tags") LOG.info(set(self.ALL_TEMPLATES).intersection(tags)) if len( - set(self.ALL_TEMPLATES).intersection(tags) + set(self.ALL_TEMPLATES).intersection(tags) ) > 0 and not self.cross_check_forc_image(tags): LOG.info("Resenv check: Skipping {0}.".format(img["name"])) return None @@ -453,11 +453,11 @@ def get_public_Images(self): images = list() try: for img in filter( - lambda x: "tags" in x - and len(x["tags"]) > 0 - and x["status"] == "active" - and x["visibility"] == "public", - self.conn.list_images(), + lambda x: "tags" in x + and len(x["tags"]) > 0 + and x["status"] == "active" + and x["visibility"] == "public", + self.conn.list_images(), ): image = self.prepare_image(img) if image is None: @@ -479,11 +479,11 @@ def get_private_Images(self): images = list() try: for img in filter( - lambda x: "tags" in x - and len(x["tags"]) > 0 - and x["status"] == "active" - and x["visibility"] == "private", - self.conn.list_images(), + lambda x: "tags" in x + and len(x["tags"]) > 0 + and x["status"] == "active" + and x["visibility"] == "private", + self.conn.list_images(), ): image = self.prepare_image(img) if image is None: @@ -536,10 +536,10 @@ def get_Images_by_filter(self, filter_list): images = list() try: for img in filter( - lambda x: "tags" in x - and len(x["tags"]) > 0 - and x["status"] == "active", - self.conn.list_images(), + lambda x: "tags" in x + and len(x["tags"]) > 0 + and x["status"] == "active", + self.conn.list_images(), ): tags = img.get("tags") if "resenv" in filter_list: @@ -792,7 +792,7 @@ def create_add_keys_script(self, keys): return key_script def create_mount_init_script( - self, volume_ids_path_new=None, volume_ids_path_attach=None + self, volume_ids_path_new=None, volume_ids_path_attach=None ): LOG.info("create init script for volume ids:{}".format(volume_ids_path_new)) if not volume_ids_path_new and not volume_ids_path_attach: @@ -941,17 +941,17 @@ def create_volume(self, volume_name, volume_storage, metadata): raise ressourceException(Reason=str(e)) def volume_ids( - self, - flavor, - image, - public_key, - servername, - metadata, - https, - http, - resenv, - volume_ids_path_new, - volume_ids_path_attach, + self, + flavor, + image, + public_key, + servername, + metadata, + https, + http, + resenv, + volume_ids_path_new, + volume_ids_path_attach, ): image = self.get_image(image=image) flavor = self.get_flavor(flavor=flavor) @@ -1024,18 +1024,18 @@ def prepare_security_groups_new_server(self, resenv, servername, http, https): return custom_security_groups def start_server_without_playbook( - self, - flavor, - image, - public_key, - servername, - metadata, - https, - http, - resenv, - volume_ids_path_new=None, - volume_ids_path_attach=None, - additional_keys=None, + self, + flavor, + image, + public_key, + servername, + metadata, + https, + http, + resenv, + volume_ids_path_new=None, + volume_ids_path_attach=None, + additional_keys=None, ): """ Start a new Server. @@ -1084,9 +1084,9 @@ def start_server_without_playbook( if init_script: add_key_script = self.create_add_keys_script(keys=additional_keys) init_script = ( - add_key_script - + encodeutils.safe_encode("\n".encode("utf-8")) - + init_script + add_key_script + + encodeutils.safe_encode("\n".encode("utf-8")) + + init_script ) else: @@ -1119,17 +1119,17 @@ def start_server_without_playbook( return {} def start_server( - self, - flavor, - image, - public_key, - servername, - metadata, - diskspace, - volumename, - https, - http, - resenv, + self, + flavor, + image, + public_key, + servername, + metadata, + diskspace, + volumename, + https, + http, + resenv, ): """ Start a new Server. @@ -1183,16 +1183,16 @@ def start_server( return {} def start_server_with_custom_key( - self, - flavor, - image, - servername, - metadata, - http, - https, - resenv, - volume_ids_path_new=None, - volume_ids_path_attach=None, + self, + flavor, + image, + servername, + metadata, + http, + https, + resenv, + volume_ids_path_new=None, + volume_ids_path_attach=None, ): """ @@ -1268,7 +1268,7 @@ def start_server_with_custom_key( return {} def create_and_deploy_playbook( - self, public_key, playbooks_information, openstack_id + self, public_key, playbooks_information, openstack_id ): global active_playbooks LOG.info(msg="Starting Playbook for (openstack_id): {0}".format(openstack_id)) @@ -1317,8 +1317,8 @@ def cross_check_forc_image(self, tags): cross_tags = list(set(self.ALL_TEMPLATES).intersection(tags)) for template_dict in templates: if ( - template_dict["name"] in self.FORC_ALLOWED - and template_dict["name"] in cross_tags + template_dict["name"] in self.FORC_ALLOWED + and template_dict["name"] in cross_tags ): if template_dict["version"] in self.FORC_ALLOWED[template_dict["name"]]: return True @@ -1951,8 +1951,8 @@ def add_udp_security_group(self, server_id): ip_base = ( list(self.conn.compute.server_ips(server=server_id))[0] - .to_dict()["address"] - .split(".")[-1] + .to_dict()["address"] + .split(".")[-1] ) x = int(ip_base) udp_port_start = eval(self.UDP_PORT_CALCULATION) @@ -2089,23 +2089,25 @@ def get_active_image_by_os_version(self, os_version, os_distro): return None def scale_up_cluster( - self, cluster_id, image, flavor, count, names, start_idx, batch_index + self, cluster_id, image, flavor, count, names, start_idx, batch_index ): cluster_info = self.get_cluster_info(cluster_id=cluster_id) image = self.get_image(image=image) if not image: - raise imageNotFoundException( - Reason=(f"No Image {image} found!") - ) + raise imageNotFoundException(Reason=(f"No Image {image} found!")) if image and image.status != "active": LOG.info(image.keys()) metadata = image.get("metadata", None) image_os_version = metadata.get("os_version", None) image_os_distro = metadata.get("os_distro", None) - image = self.get_active_image_by_os_version(os_version=image_os_version, os_distro=image_os_distro) + image = self.get_active_image_by_os_version( + os_version=image_os_version, os_distro=image_os_distro + ) if not image: raise imageNotFoundException( - Reason=(f"No active Image with os_version {image_os_version} found!") + Reason=( + f"No active Image with os_version {image_os_version} found!" + ) ) flavor = self.get_flavor(flavor=flavor) @@ -2381,9 +2383,9 @@ def delete_server(self, openstack_id): return False task_state = self.check_server_task_state(openstack_id) if ( - task_state == "image_snapshot" - or task_state == "image_pending_upload" - or task_state == "image_uploading" + task_state == "image_snapshot" + or task_state == "image_pending_upload" + or task_state == "image_uploading" ): raise ConflictException("task_state in image creating") security_groups = self.conn.list_server_security_groups(server=server) @@ -2392,7 +2394,7 @@ def delete_server(self, openstack_id): sec for sec in security_groups if sec.name != self.DEFAULT_SECURITY_GROUP_NAME - and not "bibigrid" in sec.name + and not "bibigrid" in sec.name ] if security_groups is not None: for sg in security_groups: @@ -2545,15 +2547,15 @@ def resume_server(self, openstack_id): return False def create_security_group( - self, - name, - udp_port_start=None, - ssh=True, - http=False, - https=False, - udp=False, - description=None, - resenv=[], + self, + name, + udp_port_start=None, + ssh=True, + http=False, + https=False, + udp=False, + description=None, + resenv=[], ): LOG.info("Create new security group {}".format(name)) sec = self.conn.get_security_group(name_or_id=name) @@ -2787,15 +2789,15 @@ def update_forc_allowed(self, template_metadata): class ResenvMetadata: def __init__( - self, - name, - port, - security_group_name, - security_group_description, - security_group_ssh, - direction, - protocol, - information_for_display, + self, + name, + port, + security_group_name, + security_group_description, + security_group_ssh, + direction, + protocol, + information_for_display, ): self.name = name self.port = port From af98a4d68d878fb1fad0da2b6de0cb0f9090a1c0 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sat, 8 Jan 2022 22:28:22 +0000 Subject: [PATCH 30/35] feat(Dependencies): Update dependency setuptools to v60.5.0 | datasource | package | from | to | | ---------- | ---------- | ------ | ------ | | pypi | setuptools | 60.3.1 | 60.5.0 | --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 1df009c9..4401adf9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -setuptools==60.3.1 +setuptools==60.5.0 thrift==0.15.0 python-keystoneclient openstacksdk ==0.61.0 From 6ca32312ad742fbd1dd3f89bc8f8b87028702cb1 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" Date: Sat, 8 Jan 2022 22:29:14 +0000 Subject: [PATCH 31/35] fix(Linting):blacked code --- .../VirtualMachineHandler.py | 210 +++++++++--------- 1 file changed, 106 insertions(+), 104 deletions(-) diff --git a/VirtualMachineService/VirtualMachineHandler.py b/VirtualMachineService/VirtualMachineHandler.py index a3efde29..b4106469 100644 --- a/VirtualMachineService/VirtualMachineHandler.py +++ b/VirtualMachineService/VirtualMachineHandler.py @@ -225,9 +225,9 @@ def __init__(self, config): self.FORC_REMOTE_ID = cfg["forc"]["forc_remote_id"] self.GITHUB_PLAYBOOKS_REPO = cfg["forc"]["github_playbooks_repo"] if ( - not self.RE_BACKEND_URL - or not self.FORC_API_KEY - or not self.GITHUB_PLAYBOOKS_REPO + not self.RE_BACKEND_URL + or not self.FORC_API_KEY + or not self.GITHUB_PLAYBOOKS_REPO ): raise ValueError LOG.info(msg="Forc-Backend url loaded: {0}".format(self.RE_BACKEND_URL)) @@ -370,10 +370,10 @@ def get_Images(self): images = list() try: for img in filter( - lambda x: "tags" in x - and len(x["tags"]) > 0 - and x["status"] == "active", - self.conn.list_images(), + lambda x: "tags" in x + and len(x["tags"]) > 0 + and x["status"] == "active", + self.conn.list_images(), ): metadata = img["metadata"] @@ -381,7 +381,7 @@ def get_Images(self): tags = img.get("tags") LOG.info(set(self.ALL_TEMPLATES).intersection(tags)) if len( - set(self.ALL_TEMPLATES).intersection(tags) + set(self.ALL_TEMPLATES).intersection(tags) ) > 0 and not self.cross_check_forc_image(tags): LOG.info("Resenv check: Skipping {0}.".format(img["name"])) continue @@ -417,7 +417,7 @@ def prepare_image(self, img): tags = img.get("tags") LOG.info(set(self.ALL_TEMPLATES).intersection(tags)) if len( - set(self.ALL_TEMPLATES).intersection(tags) + set(self.ALL_TEMPLATES).intersection(tags) ) > 0 and not self.cross_check_forc_image(tags): LOG.info("Resenv check: Skipping {0}.".format(img["name"])) return None @@ -453,11 +453,11 @@ def get_public_Images(self): images = list() try: for img in filter( - lambda x: "tags" in x - and len(x["tags"]) > 0 - and x["status"] == "active" - and x["visibility"] == "public", - self.conn.list_images(), + lambda x: "tags" in x + and len(x["tags"]) > 0 + and x["status"] == "active" + and x["visibility"] == "public", + self.conn.list_images(), ): image = self.prepare_image(img) if image is None: @@ -479,11 +479,11 @@ def get_private_Images(self): images = list() try: for img in filter( - lambda x: "tags" in x - and len(x["tags"]) > 0 - and x["status"] == "active" - and x["visibility"] == "private", - self.conn.list_images(), + lambda x: "tags" in x + and len(x["tags"]) > 0 + and x["status"] == "active" + and x["visibility"] == "private", + self.conn.list_images(), ): image = self.prepare_image(img) if image is None: @@ -536,10 +536,10 @@ def get_Images_by_filter(self, filter_list): images = list() try: for img in filter( - lambda x: "tags" in x - and len(x["tags"]) > 0 - and x["status"] == "active", - self.conn.list_images(), + lambda x: "tags" in x + and len(x["tags"]) > 0 + and x["status"] == "active", + self.conn.list_images(), ): tags = img.get("tags") if "resenv" in filter_list: @@ -792,7 +792,7 @@ def create_add_keys_script(self, keys): return key_script def create_mount_init_script( - self, volume_ids_path_new=None, volume_ids_path_attach=None + self, volume_ids_path_new=None, volume_ids_path_attach=None ): LOG.info("create init script for volume ids:{}".format(volume_ids_path_new)) if not volume_ids_path_new and not volume_ids_path_attach: @@ -941,17 +941,17 @@ def create_volume(self, volume_name, volume_storage, metadata): raise ressourceException(Reason=str(e)) def volume_ids( - self, - flavor, - image, - public_key, - servername, - metadata, - https, - http, - resenv, - volume_ids_path_new, - volume_ids_path_attach, + self, + flavor, + image, + public_key, + servername, + metadata, + https, + http, + resenv, + volume_ids_path_new, + volume_ids_path_attach, ): image = self.get_image(image=image) flavor = self.get_flavor(flavor=flavor) @@ -1024,18 +1024,18 @@ def prepare_security_groups_new_server(self, resenv, servername, http, https): return custom_security_groups def start_server_without_playbook( - self, - flavor, - image, - public_key, - servername, - metadata, - https, - http, - resenv, - volume_ids_path_new=None, - volume_ids_path_attach=None, - additional_keys=None, + self, + flavor, + image, + public_key, + servername, + metadata, + https, + http, + resenv, + volume_ids_path_new=None, + volume_ids_path_attach=None, + additional_keys=None, ): """ Start a new Server. @@ -1084,9 +1084,9 @@ def start_server_without_playbook( if init_script: add_key_script = self.create_add_keys_script(keys=additional_keys) init_script = ( - add_key_script - + encodeutils.safe_encode("\n".encode("utf-8")) - + init_script + add_key_script + + encodeutils.safe_encode("\n".encode("utf-8")) + + init_script ) else: @@ -1119,17 +1119,17 @@ def start_server_without_playbook( return {} def start_server( - self, - flavor, - image, - public_key, - servername, - metadata, - diskspace, - volumename, - https, - http, - resenv, + self, + flavor, + image, + public_key, + servername, + metadata, + diskspace, + volumename, + https, + http, + resenv, ): """ Start a new Server. @@ -1183,16 +1183,16 @@ def start_server( return {} def start_server_with_custom_key( - self, - flavor, - image, - servername, - metadata, - http, - https, - resenv, - volume_ids_path_new=None, - volume_ids_path_attach=None, + self, + flavor, + image, + servername, + metadata, + http, + https, + resenv, + volume_ids_path_new=None, + volume_ids_path_attach=None, ): """ @@ -1268,7 +1268,7 @@ def start_server_with_custom_key( return {} def create_and_deploy_playbook( - self, public_key, playbooks_information, openstack_id + self, public_key, playbooks_information, openstack_id ): global active_playbooks LOG.info(msg="Starting Playbook for (openstack_id): {0}".format(openstack_id)) @@ -1317,8 +1317,8 @@ def cross_check_forc_image(self, tags): cross_tags = list(set(self.ALL_TEMPLATES).intersection(tags)) for template_dict in templates: if ( - template_dict["name"] in self.FORC_ALLOWED - and template_dict["name"] in cross_tags + template_dict["name"] in self.FORC_ALLOWED + and template_dict["name"] in cross_tags ): if template_dict["version"] in self.FORC_ALLOWED[template_dict["name"]]: return True @@ -1951,8 +1951,8 @@ def add_udp_security_group(self, server_id): ip_base = ( list(self.conn.compute.server_ips(server=server_id))[0] - .to_dict()["address"] - .split(".")[-1] + .to_dict()["address"] + .split(".")[-1] ) x = int(ip_base) udp_port_start = eval(self.UDP_PORT_CALCULATION) @@ -2089,23 +2089,25 @@ def get_active_image_by_os_version(self, os_version, os_distro): return None def scale_up_cluster( - self, cluster_id, image, flavor, count, names, start_idx, batch_index + self, cluster_id, image, flavor, count, names, start_idx, batch_index ): cluster_info = self.get_cluster_info(cluster_id=cluster_id) image = self.get_image(image=image) if not image: - raise imageNotFoundException( - Reason=(f"No Image {image} found!") - ) + raise imageNotFoundException(Reason=(f"No Image {image} found!")) if image and image.status != "active": LOG.info(image.keys()) metadata = image.get("metadata", None) image_os_version = metadata.get("os_version", None) image_os_distro = metadata.get("os_distro", None) - image = self.get_active_image_by_os_version(os_version=image_os_version, os_distro=image_os_distro) + image = self.get_active_image_by_os_version( + os_version=image_os_version, os_distro=image_os_distro + ) if not image: raise imageNotFoundException( - Reason=(f"No active Image with os_version {image_os_version} found!") + Reason=( + f"No active Image with os_version {image_os_version} found!" + ) ) flavor = self.get_flavor(flavor=flavor) @@ -2381,9 +2383,9 @@ def delete_server(self, openstack_id): return False task_state = self.check_server_task_state(openstack_id) if ( - task_state == "image_snapshot" - or task_state == "image_pending_upload" - or task_state == "image_uploading" + task_state == "image_snapshot" + or task_state == "image_pending_upload" + or task_state == "image_uploading" ): raise ConflictException("task_state in image creating") security_groups = self.conn.list_server_security_groups(server=server) @@ -2392,7 +2394,7 @@ def delete_server(self, openstack_id): sec for sec in security_groups if sec.name != self.DEFAULT_SECURITY_GROUP_NAME - and not "bibigrid" in sec.name + and not "bibigrid" in sec.name ] if security_groups is not None: for sg in security_groups: @@ -2545,15 +2547,15 @@ def resume_server(self, openstack_id): return False def create_security_group( - self, - name, - udp_port_start=None, - ssh=True, - http=False, - https=False, - udp=False, - description=None, - resenv=[], + self, + name, + udp_port_start=None, + ssh=True, + http=False, + https=False, + udp=False, + description=None, + resenv=[], ): LOG.info("Create new security group {}".format(name)) sec = self.conn.get_security_group(name_or_id=name) @@ -2787,15 +2789,15 @@ def update_forc_allowed(self, template_metadata): class ResenvMetadata: def __init__( - self, - name, - port, - security_group_name, - security_group_description, - security_group_ssh, - direction, - protocol, - information_for_display, + self, + name, + port, + security_group_name, + security_group_description, + security_group_ssh, + direction, + protocol, + information_for_display, ): self.name = name self.port = port From 077933347145699b5d052481594845c7fc1af9de Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 12 Jan 2022 21:32:27 +0000 Subject: [PATCH 32/35] feat(Dependencies): Update dependency ansible to v5.2.0 | datasource | package | from | to | | ---------- | ------- | ----- | ----- | | pypi | ansible | 5.1.0 | 5.2.0 | --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 1df009c9..5b07a64b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,7 @@ python-keystoneclient openstacksdk ==0.61.0 deprecated == 1.2.13 Click==8.0.3 -ansible==5.1.0 +ansible==5.2.0 flake8==4.0.1 paramiko==2.9.1 ruamel.yaml==0.17.20 From 09ced37898471948f41f3e623e51117212e8859a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" Date: Wed, 12 Jan 2022 21:33:13 +0000 Subject: [PATCH 33/35] fix(Linting):blacked code --- .../VirtualMachineHandler.py | 210 +++++++++--------- 1 file changed, 106 insertions(+), 104 deletions(-) diff --git a/VirtualMachineService/VirtualMachineHandler.py b/VirtualMachineService/VirtualMachineHandler.py index a3efde29..b4106469 100644 --- a/VirtualMachineService/VirtualMachineHandler.py +++ b/VirtualMachineService/VirtualMachineHandler.py @@ -225,9 +225,9 @@ def __init__(self, config): self.FORC_REMOTE_ID = cfg["forc"]["forc_remote_id"] self.GITHUB_PLAYBOOKS_REPO = cfg["forc"]["github_playbooks_repo"] if ( - not self.RE_BACKEND_URL - or not self.FORC_API_KEY - or not self.GITHUB_PLAYBOOKS_REPO + not self.RE_BACKEND_URL + or not self.FORC_API_KEY + or not self.GITHUB_PLAYBOOKS_REPO ): raise ValueError LOG.info(msg="Forc-Backend url loaded: {0}".format(self.RE_BACKEND_URL)) @@ -370,10 +370,10 @@ def get_Images(self): images = list() try: for img in filter( - lambda x: "tags" in x - and len(x["tags"]) > 0 - and x["status"] == "active", - self.conn.list_images(), + lambda x: "tags" in x + and len(x["tags"]) > 0 + and x["status"] == "active", + self.conn.list_images(), ): metadata = img["metadata"] @@ -381,7 +381,7 @@ def get_Images(self): tags = img.get("tags") LOG.info(set(self.ALL_TEMPLATES).intersection(tags)) if len( - set(self.ALL_TEMPLATES).intersection(tags) + set(self.ALL_TEMPLATES).intersection(tags) ) > 0 and not self.cross_check_forc_image(tags): LOG.info("Resenv check: Skipping {0}.".format(img["name"])) continue @@ -417,7 +417,7 @@ def prepare_image(self, img): tags = img.get("tags") LOG.info(set(self.ALL_TEMPLATES).intersection(tags)) if len( - set(self.ALL_TEMPLATES).intersection(tags) + set(self.ALL_TEMPLATES).intersection(tags) ) > 0 and not self.cross_check_forc_image(tags): LOG.info("Resenv check: Skipping {0}.".format(img["name"])) return None @@ -453,11 +453,11 @@ def get_public_Images(self): images = list() try: for img in filter( - lambda x: "tags" in x - and len(x["tags"]) > 0 - and x["status"] == "active" - and x["visibility"] == "public", - self.conn.list_images(), + lambda x: "tags" in x + and len(x["tags"]) > 0 + and x["status"] == "active" + and x["visibility"] == "public", + self.conn.list_images(), ): image = self.prepare_image(img) if image is None: @@ -479,11 +479,11 @@ def get_private_Images(self): images = list() try: for img in filter( - lambda x: "tags" in x - and len(x["tags"]) > 0 - and x["status"] == "active" - and x["visibility"] == "private", - self.conn.list_images(), + lambda x: "tags" in x + and len(x["tags"]) > 0 + and x["status"] == "active" + and x["visibility"] == "private", + self.conn.list_images(), ): image = self.prepare_image(img) if image is None: @@ -536,10 +536,10 @@ def get_Images_by_filter(self, filter_list): images = list() try: for img in filter( - lambda x: "tags" in x - and len(x["tags"]) > 0 - and x["status"] == "active", - self.conn.list_images(), + lambda x: "tags" in x + and len(x["tags"]) > 0 + and x["status"] == "active", + self.conn.list_images(), ): tags = img.get("tags") if "resenv" in filter_list: @@ -792,7 +792,7 @@ def create_add_keys_script(self, keys): return key_script def create_mount_init_script( - self, volume_ids_path_new=None, volume_ids_path_attach=None + self, volume_ids_path_new=None, volume_ids_path_attach=None ): LOG.info("create init script for volume ids:{}".format(volume_ids_path_new)) if not volume_ids_path_new and not volume_ids_path_attach: @@ -941,17 +941,17 @@ def create_volume(self, volume_name, volume_storage, metadata): raise ressourceException(Reason=str(e)) def volume_ids( - self, - flavor, - image, - public_key, - servername, - metadata, - https, - http, - resenv, - volume_ids_path_new, - volume_ids_path_attach, + self, + flavor, + image, + public_key, + servername, + metadata, + https, + http, + resenv, + volume_ids_path_new, + volume_ids_path_attach, ): image = self.get_image(image=image) flavor = self.get_flavor(flavor=flavor) @@ -1024,18 +1024,18 @@ def prepare_security_groups_new_server(self, resenv, servername, http, https): return custom_security_groups def start_server_without_playbook( - self, - flavor, - image, - public_key, - servername, - metadata, - https, - http, - resenv, - volume_ids_path_new=None, - volume_ids_path_attach=None, - additional_keys=None, + self, + flavor, + image, + public_key, + servername, + metadata, + https, + http, + resenv, + volume_ids_path_new=None, + volume_ids_path_attach=None, + additional_keys=None, ): """ Start a new Server. @@ -1084,9 +1084,9 @@ def start_server_without_playbook( if init_script: add_key_script = self.create_add_keys_script(keys=additional_keys) init_script = ( - add_key_script - + encodeutils.safe_encode("\n".encode("utf-8")) - + init_script + add_key_script + + encodeutils.safe_encode("\n".encode("utf-8")) + + init_script ) else: @@ -1119,17 +1119,17 @@ def start_server_without_playbook( return {} def start_server( - self, - flavor, - image, - public_key, - servername, - metadata, - diskspace, - volumename, - https, - http, - resenv, + self, + flavor, + image, + public_key, + servername, + metadata, + diskspace, + volumename, + https, + http, + resenv, ): """ Start a new Server. @@ -1183,16 +1183,16 @@ def start_server( return {} def start_server_with_custom_key( - self, - flavor, - image, - servername, - metadata, - http, - https, - resenv, - volume_ids_path_new=None, - volume_ids_path_attach=None, + self, + flavor, + image, + servername, + metadata, + http, + https, + resenv, + volume_ids_path_new=None, + volume_ids_path_attach=None, ): """ @@ -1268,7 +1268,7 @@ def start_server_with_custom_key( return {} def create_and_deploy_playbook( - self, public_key, playbooks_information, openstack_id + self, public_key, playbooks_information, openstack_id ): global active_playbooks LOG.info(msg="Starting Playbook for (openstack_id): {0}".format(openstack_id)) @@ -1317,8 +1317,8 @@ def cross_check_forc_image(self, tags): cross_tags = list(set(self.ALL_TEMPLATES).intersection(tags)) for template_dict in templates: if ( - template_dict["name"] in self.FORC_ALLOWED - and template_dict["name"] in cross_tags + template_dict["name"] in self.FORC_ALLOWED + and template_dict["name"] in cross_tags ): if template_dict["version"] in self.FORC_ALLOWED[template_dict["name"]]: return True @@ -1951,8 +1951,8 @@ def add_udp_security_group(self, server_id): ip_base = ( list(self.conn.compute.server_ips(server=server_id))[0] - .to_dict()["address"] - .split(".")[-1] + .to_dict()["address"] + .split(".")[-1] ) x = int(ip_base) udp_port_start = eval(self.UDP_PORT_CALCULATION) @@ -2089,23 +2089,25 @@ def get_active_image_by_os_version(self, os_version, os_distro): return None def scale_up_cluster( - self, cluster_id, image, flavor, count, names, start_idx, batch_index + self, cluster_id, image, flavor, count, names, start_idx, batch_index ): cluster_info = self.get_cluster_info(cluster_id=cluster_id) image = self.get_image(image=image) if not image: - raise imageNotFoundException( - Reason=(f"No Image {image} found!") - ) + raise imageNotFoundException(Reason=(f"No Image {image} found!")) if image and image.status != "active": LOG.info(image.keys()) metadata = image.get("metadata", None) image_os_version = metadata.get("os_version", None) image_os_distro = metadata.get("os_distro", None) - image = self.get_active_image_by_os_version(os_version=image_os_version, os_distro=image_os_distro) + image = self.get_active_image_by_os_version( + os_version=image_os_version, os_distro=image_os_distro + ) if not image: raise imageNotFoundException( - Reason=(f"No active Image with os_version {image_os_version} found!") + Reason=( + f"No active Image with os_version {image_os_version} found!" + ) ) flavor = self.get_flavor(flavor=flavor) @@ -2381,9 +2383,9 @@ def delete_server(self, openstack_id): return False task_state = self.check_server_task_state(openstack_id) if ( - task_state == "image_snapshot" - or task_state == "image_pending_upload" - or task_state == "image_uploading" + task_state == "image_snapshot" + or task_state == "image_pending_upload" + or task_state == "image_uploading" ): raise ConflictException("task_state in image creating") security_groups = self.conn.list_server_security_groups(server=server) @@ -2392,7 +2394,7 @@ def delete_server(self, openstack_id): sec for sec in security_groups if sec.name != self.DEFAULT_SECURITY_GROUP_NAME - and not "bibigrid" in sec.name + and not "bibigrid" in sec.name ] if security_groups is not None: for sg in security_groups: @@ -2545,15 +2547,15 @@ def resume_server(self, openstack_id): return False def create_security_group( - self, - name, - udp_port_start=None, - ssh=True, - http=False, - https=False, - udp=False, - description=None, - resenv=[], + self, + name, + udp_port_start=None, + ssh=True, + http=False, + https=False, + udp=False, + description=None, + resenv=[], ): LOG.info("Create new security group {}".format(name)) sec = self.conn.get_security_group(name_or_id=name) @@ -2787,15 +2789,15 @@ def update_forc_allowed(self, template_metadata): class ResenvMetadata: def __init__( - self, - name, - port, - security_group_name, - security_group_description, - security_group_ssh, - direction, - protocol, - information_for_display, + self, + name, + port, + security_group_name, + security_group_description, + security_group_ssh, + direction, + protocol, + information_for_display, ): self.name = name self.port = port From 7563d5b7b5a52f56528da74fee56c9838a0a5a13 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 13 Jan 2022 21:37:14 +0000 Subject: [PATCH 34/35] feat(Dependencies): Update docker.elastic.co/beats/filebeat Docker tag to v7.16.3 | datasource | package | from | to | | ---------- | -------------------------------- | ------ | ------ | | docker | docker.elastic.co/beats/filebeat | 7.16.2 | 7.16.3 | | docker | docker.elastic.co/beats/filebeat | 7.16.2 | 7.16.3 | --- docker-compose.bibigrid.yml | 2 +- docker-compose.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.bibigrid.yml b/docker-compose.bibigrid.yml index e588596b..79ea9504 100644 --- a/docker-compose.bibigrid.yml +++ b/docker-compose.bibigrid.yml @@ -38,7 +38,7 @@ services: # filebeat filebeat: - image: docker.elastic.co/beats/filebeat:7.16.2 + image: docker.elastic.co/beats/filebeat:7.16.3 env_file: - .env volumes: diff --git a/docker-compose.yml b/docker-compose.yml index 6fbd8ac5..450bb3a6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,7 +26,7 @@ services: # filebeat filebeat: container_name: client_filebeat - image: docker.elastic.co/beats/filebeat:7.16.2 + image: docker.elastic.co/beats/filebeat:7.16.3 env_file: - .env volumes: From 2f0b6802fdebaccce318a85177bfcdefec474778 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 17 Jan 2022 12:06:42 +0000 Subject: [PATCH 35/35] feat(Dependencies): Update dependency redis to v4.1.1 | datasource | package | from | to | | ---------- | ------- | ----- | ----- | | pypi | redis | 4.1.0 | 4.1.1 | --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 9932ffe4..6742005c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,6 +9,6 @@ flake8==4.0.1 paramiko==2.9.2 ruamel.yaml==0.17.20 pyvim==3.0.2 -redis==4.1.0 +redis==4.1.1 requests==2.27.1 pyyaml==6.0