diff options
Diffstat (limited to 'sdv/docker/sdvconfig')
-rw-r--r-- | sdv/docker/sdvconfig/Dockerfile | 6 | ||||
-rw-r--r-- | sdv/docker/sdvconfig/cli_validation.py | 17 | ||||
-rw-r--r-- | sdv/docker/sdvconfig/requirements.txt | 5 | ||||
-rw-r--r-- | sdv/docker/sdvconfig/validation/info.py | 3 |
4 files changed, 23 insertions, 8 deletions
diff --git a/sdv/docker/sdvconfig/Dockerfile b/sdv/docker/sdvconfig/Dockerfile index d66ccc7..085d42e 100644 --- a/sdv/docker/sdvconfig/Dockerfile +++ b/sdv/docker/sdvconfig/Dockerfile @@ -5,6 +5,10 @@ RUN mkdir sdvconfig # change the workdir to the newly created file WORKDIR /sdvconfig/ +# install git +RUN apt update +RUN apt install -y git + # install from requirements.txt COPY requirements.txt /sdvconfig/requirements.txt RUN pip install -r requirements.txt @@ -16,7 +20,7 @@ COPY mapping/ /sdvconfig/mapping/ COPY validation/ /sdvconfig/validation/ COPY server.py /sdvconfig/ COPY cli_validation.py /sdvconfig/ -COPY testapi/ sdvconfig/testapi/ +COPY testapi/ /sdvconfig/testapi/ COPY manifest /sdvconfig/manifest/ # expose port for rest calls diff --git a/sdv/docker/sdvconfig/cli_validation.py b/sdv/docker/sdvconfig/cli_validation.py index 70e498e..30477fd 100644 --- a/sdv/docker/sdvconfig/cli_validation.py +++ b/sdv/docker/sdvconfig/cli_validation.py @@ -70,7 +70,7 @@ class Validate(): # create a directory called /tmp try: - os.mkdir('/tmp') + os.makedirs('/tmp', exist_ok=True) except OSError: self.logger.exception("creation of directory failed") raise @@ -87,7 +87,10 @@ class Validate(): # clone the installer repo try: - Repo.clone_from(inst_dir, os.path.join('/tmp', 'inst')) + clone_dir = os.path.join('/tmp', 'inst') + if os.path.exists(clone_dir) and os.path.isdir(clone_dir): + shutil.rmtree(clone_dir) + Repo.clone_from(inst_dir, clone_dir) self.inst_dir = os.path.join('/tmp', 'inst') self.downloaded = True except ConnectionError: @@ -98,7 +101,10 @@ class Validate(): # download the global file try: - Repo.clone_from(GLOBAL_DIR, os.path.join('/tmp', 'global')) + clone_dir = os.path.join('/tmp', 'global') + if os.path.exists(clone_dir) and os.path.isdir(clone_dir): + shutil.rmtree(clone_dir) + Repo.clone_from(GLOBAL_DIR, clone_dir) self.gsw = os.path.join('/tmp', 'global', 'global', 'software') except ConnectionError: self.logger.exception("failed to download the global git repo") @@ -153,6 +159,7 @@ class Validate(): self.total)) self.result += result + string + # iterate through the roles: have a class for each for each of the roles for _, value in enumerate(self.json["roles"]): role = value["name"] @@ -208,7 +215,7 @@ class Validate(): correct, wrong, total)) self.result += result + string - self.testapi_result["timestamp"] = datetime.datetime.now() + self.testapi_result["timestamp"] = datetime.datetime.now().isoformat() self.testapi_result["correct"] = self.correct self.testapi_result["wrong"] = self.wrong self.testapi_result["total"] = self.total @@ -246,4 +253,4 @@ if __name__ == "__main__": # Read arguments from the command line ARGS = PARSER.parse_args() - print(ARGS.inst_dir, ARGS.inst_type, ARGS.pdf, ARGS.sitename).validate() + Validate(ARGS.inst_dir, ARGS.inst_type, ARGS.pdf, ARGS.sitename).validate() diff --git a/sdv/docker/sdvconfig/requirements.txt b/sdv/docker/sdvconfig/requirements.txt index c3368df..7b5708c 100644 --- a/sdv/docker/sdvconfig/requirements.txt +++ b/sdv/docker/sdvconfig/requirements.txt @@ -1 +1,6 @@ tornado +requests +pyyaml +GitPython +netaddr + diff --git a/sdv/docker/sdvconfig/validation/info.py b/sdv/docker/sdvconfig/validation/info.py index 2d2b498..a66b9f7 100644 --- a/sdv/docker/sdvconfig/validation/info.py +++ b/sdv/docker/sdvconfig/validation/info.py @@ -156,8 +156,7 @@ class InfoValidation(): "data_plane_used", "ironic_deploy_interface", "external_storage_cluster", - "bl_str_connect_method", - "cpu_allocation_ratio"] + "bl_str_connect_method"] val = self.json[profile] |