Skip to content

Commit 0740dc4

Browse files
committed
offline_repo path updated
1 parent 5030b69 commit 0740dc4

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

common/library/module_utils/local_repo/download_common.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ def process_file_without_download(repository_name, output_file, relative_path,
379379
finally:
380380
logger.info("#" * 30 + f" {process_file_without_download.__name__} end " + "#" * 30)
381381

382-
def process_manifest(file,repo_store_path, status_file_path,logger):
382+
def process_manifest(file,repo_store_path, status_file_path, cluster_os_type, cluster_os_version, arc,logger):
383383
"""
384384
Process a manifest file.
385385
Args:
@@ -404,7 +404,7 @@ def process_manifest(file,repo_store_path, status_file_path,logger):
404404
subprocess.run(['wget', '-q', '--spider', '--tries=1', url], check=True)
405405

406406
# Ensure the manifest directory exists
407-
manifest_directory = os.path.join(repo_store_path, "offline_repo", "cluster", "manifest", package_name)
407+
manifest_directory = os.path.join(repo_store_path, "offline_repo", "cluster",arc.lower(), cluster_os_type, cluster_os_version, "manifest", package_name)
408408
# # Determine the manifest file path
409409
file_path = os.path.join(manifest_directory, f"{package_name}.yaml")
410410
repository_name = "manifest" + package_name
@@ -427,7 +427,7 @@ def process_manifest(file,repo_store_path, status_file_path,logger):
427427
logger.info("#" * 30 + f" {process_manifest.__name__} end " + "#" * 30) # End of function
428428
return status
429429

430-
def process_git(file,repo_store_path, status_file_path,logger):
430+
def process_git(file,repo_store_path, status_file_path, cluster_os_type, cluster_os_version, arc,logger):
431431
"""
432432
Process a Git package.
433433
Args:
@@ -455,7 +455,7 @@ def process_git(file,repo_store_path, status_file_path,logger):
455455
logger.info(f"Processing Git Package: {package_name}, URL: {url}, Version: {version}")
456456

457457
# Assuming you have a specific path to store Git packages
458-
git_modules_directory = os.path.join(repo_store_path, "offline_repo", 'cluster', 'git', package_name)
458+
git_modules_directory = os.path.join(repo_store_path, "offline_repo", 'cluster',arc.lower(), cluster_os_type, cluster_os_version, 'git', package_name)
459459
os.makedirs(git_modules_directory, exist_ok=True) # Ensure the directory exists
460460

461461
clone_directory = os.path.join(git_modules_directory, package_name)
@@ -502,7 +502,7 @@ def process_git(file,repo_store_path, status_file_path,logger):
502502
return status
503503

504504
# Function to process a shell file
505-
def process_shell(file,repo_store_path, status_file_path,logger):
505+
def process_shell(file,repo_store_path, status_file_path, cluster_os_type, cluster_os_version, arc,logger):
506506
"""
507507
Process a shell package.
508508
@@ -526,7 +526,7 @@ def process_shell(file,repo_store_path, status_file_path,logger):
526526
logger.info(f"Processing sh Package: {package_name}, URL: {url}")
527527

528528
# Creating the local path to save the sh file
529-
sh_directory = os.path.join(repo_store_path, "offline_repo", 'cluster', 'shell', package_name)
529+
sh_directory = os.path.join(repo_store_path, "offline_repo", 'cluster',arc.lower(), cluster_os_type, cluster_os_version, 'shell', package_name)
530530
os.makedirs(sh_directory, exist_ok=True) # Ensure the directory exists
531531

532532
sh_path = os.path.join(sh_directory, f"{package_name}.sh")
@@ -548,7 +548,7 @@ def process_shell(file,repo_store_path, status_file_path,logger):
548548
logger.info("#" * 30 + f" {process_shell.__name__} end " + "#" * 30) # End of function
549549
return status
550550

551-
def process_ansible_galaxy_collection(file, repo_store_path, status_file_path, logger):
551+
def process_ansible_galaxy_collection(file, repo_store_path, status_file_path, cluster_os_type, cluster_os_version, arc, logger):
552552
"""
553553
Process an Ansible Galaxy Collection.
554554
@@ -577,7 +577,7 @@ def process_ansible_galaxy_collection(file, repo_store_path, status_file_path, l
577577
)
578578

579579
# Assuming you have a specific path to store Ansible Galaxy Collections
580-
galaxy_collections_directory = os.path.join(repo_store_path, "offline_repo", 'cluster', 'ansible_galaxy_collection', package_name)
580+
galaxy_collections_directory = os.path.join(repo_store_path, "offline_repo", 'cluster', arc.lower(), cluster_os_type, cluster_os_version, 'ansible_galaxy_collection', package_name)
581581
galaxy_collections_directory = shlex.quote(galaxy_collections_directory).strip("'\"")
582582
os.makedirs(galaxy_collections_directory, exist_ok=True) # Ensure the directory exists
583583
collections_tarball_path = os.path.join(galaxy_collections_directory, f'{package_name.replace(".", "-")}-{version}.tar.gz')
@@ -852,7 +852,7 @@ def process_iso(package, repo_store_path, status_file_path,
852852
logger.info("#" * 30 + f" {process_iso.__name__} end " + "#" * 30) # End of function
853853
return status
854854

855-
def process_pip(package, repo_store_path, status_file_path, logger):
855+
def process_pip(package, repo_store_path, status_file_path, cluster_os_type, cluster_os_version, arc,logger):
856856
"""
857857
Process a pip package using Pulp.
858858
@@ -877,8 +877,8 @@ def process_pip(package, repo_store_path, status_file_path, logger):
877877
logger.info(f"Processing Pip Package: {package_name}, Version: {version}")
878878

879879
# Define storage path
880-
pip_package_directory = os.path.join(repo_store_path, "offline_repo", 'cluster', 'pip_module', package_name)
881-
base_package_directory = os.path.join(repo_store_path, "offline_repo", 'cluster', 'pip_module', package_name)
880+
pip_package_directory = os.path.join(repo_store_path, "offline_repo", 'cluster',arc.lower(), cluster_os_type, cluster_os_version, 'pip_module', package_name)
881+
base_package_directory = os.path.join(repo_store_path, "offline_repo", 'cluster', arc.lower(), cluster_os_type, cluster_os_version,'pip_module', package_name)
882882
base_package_directory = base_package_directory.strip("/")
883883

884884
os.makedirs(pip_package_directory, exist_ok=True) # Ensure directory exists

common/library/modules/parallel_tasks.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,20 +147,20 @@ def determine_function(task, repo_store_path, csv_file_path, user_data, version_
147147

148148
task_type = task.get("type")
149149
if task_type == "manifest":
150-
return process_manifest, [task, repo_store_path, status_file]
150+
return process_manifest, [task, repo_store_path, status_file, cluster_os_type, cluster_os_version, arc]
151151
if task_type == "git":
152-
return process_git, [task, repo_store_path, status_file]
152+
return process_git, [task, repo_store_path, status_file, cluster_os_type, cluster_os_version, arc]
153153
if task_type == "tarball":
154154
return process_tarball, [task, repo_store_path, status_file, version_variables, cluster_os_type, cluster_os_version, arc]
155155
if task_type == "shell":
156-
return process_shell, [task, repo_store_path, status_file]
156+
return process_shell, [task, repo_store_path, status_file, cluster_os_type, cluster_os_version, arc]
157157
if task_type == "ansible_galaxy_collection":
158-
return process_ansible_galaxy_collection, [task, repo_store_path, status_file]
158+
return process_ansible_galaxy_collection, [task, repo_store_path, status_file, cluster_os_type, cluster_os_version, arc]
159159
if task_type == "iso":
160160
return process_iso, [task, repo_store_path, status_file,
161161
cluster_os_type, cluster_os_version, version_variables, arc]
162162
if task_type == "pip_module":
163-
return process_pip, [task, repo_store_path, status_file]
163+
return process_pip, [task, repo_store_path, status_file, cluster_os_type, cluster_os_version, arc]
164164
if task_type == "image":
165165
return process_image, [task, status_file, version_variables, user_registries, docker_username, docker_password]
166166
if task_type == "rpm":

0 commit comments

Comments
 (0)