Skip to content

Commit

Permalink
Pipeline bugfixes- Fedora type Other, raise for permission error (#1493)
Browse files Browse the repository at this point in the history
  • Loading branch information
jarosenb authored Jan 15, 2025
1 parent 3b59186 commit 90033c4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,10 @@ class ProjectFileNotFound(Exception):
"""exception raised when attempting to copy a non-existent file for publication"""


class PublicationDirectoryAlreadyExists(Exception):
"""exception raised when attempting to publish into a directory that exists already"""


def copy_publication_files(
path_mapping: dict, project_id: str, version: Optional[int] = None
):
Expand All @@ -393,6 +397,13 @@ def copy_publication_files(
pub_dirname = f"{project_id}v{version}"

pub_root_dir = str(Path(f"{settings.DESIGNSAFE_PUBLISHED_PATH}") / pub_dirname)

# Prevent multiple attempts to publish the same project files.
if os.path.isdir(pub_root_dir):
raise PublicationDirectoryAlreadyExists(
f"Directory already exists: {pub_root_dir}"
)

os.makedirs(pub_root_dir, exist_ok=True)

for src_path in path_mapping:
Expand Down Expand Up @@ -427,6 +438,7 @@ def copy_publication_files(
except PermissionError as exc:
logger.error(exc)
send_project_permissions_alert(project_id, version, str(exc))
raise exc

finally:
os.chmod("/corral-repl/tacc/NHERI/published", 0o555)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def generate_manifest_other(project_id, version=1):
"""Generate the file manifest for an Other-type project"""
fido_client = Fido()
pub = Publication.objects.get(project_id=project_id)
uuid = pub.tree.nodes[0]["uuid"]
uuid = pub.tree["nodes"][0]["uuid"]
file_tags = pub.value.get("fileTags", [])

if version and version > 1:
Expand Down

0 comments on commit 90033c4

Please sign in to comment.