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 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 deleted file mode 100644 index c59f4bde..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.11.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 - 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 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 diff --git a/VirtualMachineService/VirtualMachineHandler.py b/VirtualMachineService/VirtualMachineHandler.py index f22c4266..b4106469 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))) @@ -2073,11 +2074,42 @@ 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 ): 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!")) + 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 + ) + 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 = [] diff --git a/docker-compose.bibigrid.yml b/docker-compose.bibigrid.yml index 1edc9bc4..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.1 + image: docker.elastic.co/beats/filebeat:7.16.3 env_file: - .env volumes: diff --git a/docker-compose.yml b/docker-compose.yml index 1bb8568c..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.1 + image: docker.elastic.co/beats/filebeat:7.16.3 env_file: - .env volumes: diff --git a/renovate.json b/renovate.json index 5f0bd44e..1aba1583 100644 --- a/renovate.json +++ b/renovate.json @@ -22,9 +22,13 @@ "addLabels": ["pin"] } ], +<<<<<<< HEAD "vulnerabilityAlerts": { "labels": ["security"] }, +======= + +>>>>>>> staging "baseBranches": ["dev"], "reviewers": ["team:portal-dev"], "labels": ["dependencies"], diff --git a/requirements.txt b/requirements.txt index b4b6661d..6742005c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,14 +1,14 @@ -setuptools==59.6.0 +setuptools==60.5.0 thrift==0.15.0 python-keystoneclient openstacksdk ==0.61.0 deprecated == 1.2.13 Click==8.0.3 -ansible==5.0.1 +ansible==5.2.0 flake8==4.0.1 -ruamel.yaml<0.18.0 -paramiko==2.8.1 +paramiko==2.9.2 +ruamel.yaml==0.17.20 pyvim==3.0.2 -redis==4.0.2 -requests==2.26.0 +redis==4.1.1 +requests==2.27.1 pyyaml==6.0 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)