Skip to content
This repository was archived by the owner on Jan 19, 2018. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions atomicapp/nulecule/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,8 @@ def _get_artifact_paths_for_path(self, path):
immediate children, i.e., we do not deal with nested artifact
directories at this moment.

If a file or directory is not found, raise an exception.

Args:
path (str): Local path

Expand All @@ -558,9 +560,14 @@ def _get_artifact_paths_for_path(self, path):
if os.path.isfile(path):
artifact_paths.append(path)
elif os.path.isdir(path):
if os.listdir(path) == []:
raise NuleculeException("Artifact directory %s is empty" % path)
for dir_child in os.listdir(path):
dir_child_path = os.path.join(path, dir_child)
if dir_child.startswith('.') or os.path.isdir(dir_child_path):
continue
artifact_paths.append(dir_child_path)
else:
raise NuleculeException("Unable to find artifact %s" % path)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so right now we only raise an exception if the file or dir doesn't exist. what happens if they pass us a directory but the directory is empty? Should that be an error?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dustymabe Updated to include this too :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of putting our logic in the if/else statements maybe we should just check to see if artifact_paths is empty before we return and raise an exception there?

return artifact_paths