Skip to content

Commit

Permalink
Do not create project twice.
Browse files Browse the repository at this point in the history
Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
  • Loading branch information
phracek committed Aug 1, 2024
1 parent b11166a commit ce48091
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 0 additions & 2 deletions container_ci_suite/helm.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ def __init__(
self.delete_prj: bool = delete_prj
self.create_prj: bool = True
self.oc_api = OpenShiftAPI(create_prj=self.create_prj, delete_prj=self.delete_prj)
self.oc_api.create_prj = self.create_prj
self.oc_api.create_project()
self.pod_json_data: dict = {}
self.pod_name_prefix: str = ""
self.namespace = self.set_namespace()
Expand Down
17 changes: 9 additions & 8 deletions container_ci_suite/openshift.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,16 @@ def delete_project(self):
if not self.delete_prj:
print("Deleting project is SUPPRESSED.")
# project is not deleted by request user
pass
if self.shared_cluster:
print("Delete project on shared cluster")
self.delete_tenant_namespace()
else:
run_oc_command("project default", json_output=False)
run_oc_command(
f"delete project {self.namespace} --grace-period=0 --force", json_output=False
)
if self.shared_cluster:
print("Delete project on shared cluster")
self.delete_tenant_namespace()
else:
print(f"Deleting project {self.namespace}")
run_oc_command("project default", json_output=False)
run_oc_command(
f"delete project {self.namespace} --grace-period=0 --force", json_output=False
)

def run_command_in_pod(self, pod_name, command: str = "") -> str:
output = run_oc_command(f"exec {pod_name} -- \"{command}\"")
Expand Down
1 change: 1 addition & 0 deletions container_ci_suite/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ def load_shared_credentials(credential: str) -> Any:

def is_share_cluster() -> bool:
file_shared_cluster = load_shared_credentials("SHARED_CLUSTER")
print(f"Is shared cluster allowed? {file_shared_cluster}")
if not file_shared_cluster:
return False
if file_shared_cluster in ["True", "true", "1", "yes", "Yes", "y", "Y"]:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def get_requirements():
description='A python3 container CI tool for testing images.',
long_description=long_description,
long_description_content_type='text/markdown',
version="0.3.0",
version="0.3.2",
keywords='tool,containers,images,tests',
packages=find_packages(exclude=["tests"]),
url="https://github.com/sclorg/container-ci-suite",
Expand Down

0 comments on commit ce48091

Please sign in to comment.